:root {
  color-scheme: dark;
  --bg: #070a0f;
  --bg-soft: #0a0e14;
  --panel: rgba(17, 22, 30, 0.72);
  --panel-solid: #101620;
  --panel-2: #141b26;
  --elev: 0 20px 50px -24px rgba(0, 0, 0, 0.8);
  --text: #e9f0f7;
  --text-strong: #ffffff;
  --muted: #8b9bab;
  --faint: #5d6b7a;
  --line: rgba(120, 140, 160, 0.16);
  --line-strong: rgba(120, 140, 160, 0.26);
  --accent: #38f3ab;
  --accent-dim: rgba(56, 243, 171, 0.14);
  --accent-2: #4cc9ff;
  --accent-2-dim: rgba(76, 201, 255, 0.14);
  --grad: linear-gradient(120deg, #38f3ab 0%, #4cc9ff 100%);
  --danger: #ff6b6b;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-glow: 0 0 0 1px var(--accent-dim), 0 16px 40px -20px rgba(56, 243, 171, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  font-feature-settings: "ss01", "cv01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(1100px 500px at 12% -8%, rgba(56, 243, 171, 0.10), transparent 60%),
    radial-gradient(900px 460px at 88% -10%, rgba(76, 201, 255, 0.10), transparent 60%),
    radial-gradient(700px 700px at 50% 120%, rgba(76, 201, 255, 0.05), transparent 60%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 40%, transparent 85%);
  z-index: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

code {
  font-family: var(--mono);
}

/* ---- Shell & layout ---- */

.shell {
  position: relative;
  z-index: 1;
  width: min(1220px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

/* ---- Top bar ---- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 30px;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 60%),
    rgba(10, 14, 20, 0.6);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 14px;
  z-index: 20;
  box-shadow: 0 12px 30px -18px rgba(0, 0, 0, 0.7);
}

.topbar h1,
.panel h2 {
  margin: 0;
  letter-spacing: -0.02em;
}

.topbar h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.top-actions,
.panel-head,
.amount-row,
.slippage-row,
.segments {
  display: flex;
  align-items: center;
}

.top-actions {
  gap: 10px;
}

/* ---- Buttons ---- */

.icon-button,
.icon-link,
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.12s ease, color 0.18s ease;
}

.icon-button:hover,
.icon-link:hover {
  border-color: var(--line-strong);
  background: #1a2330;
}

.icon-button:active,
.icon-link:active {
  transform: translateY(1px);
}

.icon-button:focus-visible,
.icon-link:focus-visible,
.primary:focus-visible,
.secondary:focus-visible,
.swap-button:focus-visible,
.segment:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.primary {
  min-height: 42px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  background: var(--grad);
  color: #05110b;
  font-weight: 800;
  border: 1px solid transparent;
  box-shadow: 0 8px 22px -12px rgba(56, 243, 171, 0.7);
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px -12px rgba(56, 243, 171, 0.75);
  filter: brightness(1.04);
}

.primary:active {
  transform: translateY(0);
}

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

.grid {
  display: grid;
  grid-template-columns: minmax(340px, 1.18fr) minmax(300px, 0.82fr);
  gap: 18px;
  align-items: start;
}

/* ---- Panels ---- */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 22px;
  backdrop-filter: blur(10px);
  box-shadow: var(--elev);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(76, 201, 255, 0.5), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.panel:hover {
  border-color: var(--line-strong);
}

.panel:hover::before {
  opacity: 1;
}

.swap-panel {
  min-height: 470px;
}

.details-panel {
  grid-column: span 2;
  background: var(--panel-solid);
}

.panel-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.panel-head h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

.muted-inline {
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 400;
  font-style: italic;
}

.sub-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* ---- Pill ---- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--panel-2);
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.pill.ok {
  border-color: rgba(56, 243, 171, 0.4);
  color: var(--accent);
  background: var(--accent-dim);
}

.pill.ok::before {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* ---- Stats ---- */

.stats {
  display: grid;
  gap: 4px;
  margin: 0;
}

.stats div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
}

.stats div:last-child {
  border-bottom: 0;
}

.stats dt {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.01em;
}

dd {
  margin: 0;
  text-align: right;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

/* ---- Amount input ---- */

.field-label,
.quote-box span,
.slippage-row > span {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.amount-row {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  padding: 0 18px;
  margin: 10px 0 16px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.amount-row:focus-within {
  border-color: rgba(76, 201, 255, 0.55);
  box-shadow: 0 0 0 3px var(--accent-2-dim);
}

.amount-row input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-strong);
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.amount-row input::placeholder {
  color: var(--faint);
  font-weight: 500;
}

.amount-row span {
  flex: 0 0 auto;
  color: var(--accent-2);
  font-weight: 800;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

/* ---- Quote box ---- */

.quote-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 15px 18px;
  margin-bottom: 16px;
  background: linear-gradient(180deg, var(--accent-dim), transparent 90%);
}

.quote-box strong {
  text-align: right;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---- Slippage ---- */

.slippage-row {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.segments {
  gap: 6px;
}

.segment {
  min-width: 68px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.segment:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.segment:active {
  transform: translateY(1px);
}

.segment.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ---- Swap / secondary buttons ---- */

.swap-button {
  width: 100%;
  min-height: 54px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  background: var(--grad);
  color: #05110b;
  box-shadow: 0 12px 30px -14px rgba(56, 243, 171, 0.8);
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.swap-button:not(:disabled):hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 16px 40px -14px rgba(56, 243, 171, 0.85);
}

.swap-button:not(:disabled):active {
  transform: translateY(0);
}

.secondary {
  width: 100%;
  min-height: 46px;
  margin-top: 16px;
}

/* ---- Address list ---- */

.address-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.address-list span {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.015);
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.address-list code {
  color: var(--text-strong);
  font-size: 12.5px;
  overflow-wrap: anywhere;
  text-transform: none;
  letter-spacing: 0;
}

/* ---- Status ---- */

.status {
  margin-top: 22px;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 18px;
  color: var(--muted);
  background: rgba(10, 14, 20, 0.7);
  font-size: 13.5px;
  position: relative;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
  flex: 0 0 auto;
  animation: pulse 2.4s infinite;
}

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

/* ---- Footer ---- */

.foot {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--faint);
  font-size: 12px;
}

.foot .brand {
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.foot .brand em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---- Tab navigation ---- */

.tabbar {
  display: flex;
  gap: 8px;
  margin: 0 0 22px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 14, 20, 0.6);
  backdrop-filter: blur(12px);
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab {
  flex: 1 1 auto;
  min-width: max-content;
  padding: 11px 22px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.01em;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

.tab.active {
  color: var(--text-strong);
  background: linear-gradient(180deg, rgba(56, 243, 171, 0.16), rgba(76, 201, 255, 0.10));
  border-color: rgba(56, 243, 171, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.tab-body {
  min-height: 320px;
}

/* ---- Dashboard ---- */

.dash {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0;
}

.metric {
  display: grid;
  gap: 8px;
  padding: 20px 22px;
}

.metric strong {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.table-panel {
  grid-column: span 2;
  background: var(--panel-solid);
}

.table-wrap {
  overflow-x: auto;
}

.market-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.market-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.market-table tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.market-table tbody tr {
  transition: background 0.15s ease;
}

.market-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.market-table tbody tr:last-child td {
  border-bottom: 0;
}

.pair-name {
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}

.pair-name .sep {
  color: var(--faint);
  margin: 0 4px;
}

.addr {
  font-size: 12px;
  color: var(--accent-2);
}

@media (max-width: 1080px) {
  .dash {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- Bridge / Liquidity forms ---- */

.bridge-hint {
  margin: 0 0 16px;
  line-height: 1.5;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.addr-row input {
  font-size: 15px;
  font-family: var(--mono);
  letter-spacing: 0;
}

.mode-seg {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}

.mode-seg .segment {
  flex: 1 1 auto;
}

/* ---- Locker ---- */

.locker-panel {
  grid-column: span 1;
  max-width: 760px;
}

.locker-feature-grid {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.feature {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}

.feature strong {
  color: var(--text-strong);
  font-size: 14px;
}

.feature span {
  color: var(--muted);
  font-size: 13px;
}

/* ---- Responsive ---- */

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 24px, 560px);
    padding: 16px 0 48px;
  }

  .topbar,
  .grid,
  .address-list {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    position: static;
    gap: 14px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .primary {
    grid-column: span 2;
  }

  .details-panel {
    grid-column: auto;
  }

  .amount-row input {
    font-size: 26px;
  }

  .foot {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .table-panel {
    grid-column: auto;
  }

  .feature {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .tabbar .tab {
    padding: 10px 16px;
    font-size: 13px;
  }
}