:root {
  color-scheme: dark;
  --night: #0b0717;
  --panel: rgba(21, 14, 41, 0.9);
  --panel-strong: rgba(33, 23, 65, 0.96);
  --line: rgba(221, 215, 254, 0.24);
  --line-strong: rgba(221, 215, 254, 0.38);
  --control: rgba(6, 3, 17, 0.78);
  --muted: #b9addf;
  --text: #fff;
  --purple: #6e54ff;
  --purple-soft: #9b83ff;
  --lavender: #ddd7fe;
  --cyan: #85e6ff;
  --pink: #ff8ee4;
  --gold: #ffcf75;
  --green: #7dffbd;
  --warn: #ffcf75;
  --bad: #ff7f9e;
  --shadow-purple: rgba(110, 84, 255, 0.36);
  --shadow-cyan: rgba(133, 230, 255, 0.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(133, 230, 255, 0.16), transparent 32rem),
    radial-gradient(circle at 84% 8%, rgba(255, 142, 228, 0.12), transparent 28rem),
    linear-gradient(135deg, #070310 0%, #180d33 48%, #05030b 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent 72%);
  opacity: 0.45;
  animation: grid-drift 18s linear infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(110deg, transparent 0 42px, rgba(133, 230, 255, 0.035) 42px 43px, transparent 43px 86px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.035), transparent 18%, rgba(0, 0, 0, 0.24));
  opacity: 0.7;
  mix-blend-mode: screen;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0;
  position: relative;
  z-index: 1;
}

.hero {
  min-height: 220px;
  display: grid;
  grid-template-columns: 1fr minmax(280px, 420px);
  gap: 18px;
  align-items: stretch;
}

.brand-lockup,
.wallet-card,
.panel,
.quote-board {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(110, 84, 255, 0.08)),
    var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  animation: surface-rise 0.55s ease both;
}

.brand-lockup {
  min-height: 220px;
  padding: 30px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 24px;
  overflow: hidden;
  position: relative;
}

.brand-lockup::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(221, 215, 254, 0.12);
  border-radius: 14px;
  pointer-events: none;
  box-shadow: inset 0 0 28px rgba(133, 230, 255, 0.08);
}

.brand-lockup::after {
  content: "";
  position: absolute;
  inset: auto -10% -45% 28%;
  height: 180px;
  background: linear-gradient(90deg, transparent, rgba(221, 215, 254, 0.28), transparent);
  transform: rotate(-8deg);
  animation: hero-sweep 6s ease-in-out infinite;
}

.brand-lockup img {
  width: clamp(96px, 15vw, 156px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 18px 46px rgba(110, 84, 255, 0.42), 0 0 0 8px rgba(110, 84, 255, 0.1);
  position: relative;
  z-index: 1;
  animation: logo-float 5s ease-in-out infinite;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 780px;
  font-size: clamp(2.2rem, 6vw, 5rem);
  line-height: 0.92;
  position: relative;
  z-index: 1;
  text-shadow: 0 10px 38px rgba(110, 84, 255, 0.32), 0 0 1px rgba(255, 255, 255, 0.6);
}

h2 {
  font-size: clamp(1.45rem, 2vw, 2.15rem);
}

.wallet-card {
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  animation-delay: 0.08s;
}

.wallet-card #connect-wallet {
  width: 100%;
}

.wallet-card p,
.quote-box p,
.token-card p {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(221, 215, 254, 0.28);
  background: linear-gradient(135deg, rgba(221, 215, 254, 0.12), rgba(110, 84, 255, 0.12));
  color: var(--lavender);
  font-size: 0.8rem;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  gap: 18px;
  margin-top: 18px;
}

.tabs {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  padding: 6px;
  width: fit-content;
  border: 1px solid rgba(221, 215, 254, 0.16);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 14px 38px rgba(0, 0, 0, 0.24);
  animation: surface-rise 0.55s ease 0.1s both;
}

.tab,
.segment,
.primary,
.secondary,
.ghost,
.icon-button {
  min-height: 42px;
  border-radius: 10px;
  color: var(--text);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.tab,
.ghost,
.icon-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
}

.tab {
  min-width: 124px;
  padding: 0 18px;
  font-weight: 800;
}

.tab.is-active,
.segment.is-active {
  background: linear-gradient(135deg, var(--purple), var(--purple-soft));
  border-color: rgba(255, 255, 255, 0.38);
  box-shadow: 0 10px 26px rgba(110, 84, 255, 0.26);
}

.primary,
.secondary {
  padding: 0 20px;
  font-weight: 900;
}

.primary::before,
.secondary::before,
.tab.is-active::before {
  content: "";
  position: absolute;
  inset: -80% auto -80% -55%;
  width: 44%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: rotate(18deg);
  opacity: 0;
}

.primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-soft));
  box-shadow: 0 14px 30px rgba(110, 84, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.secondary {
  background: linear-gradient(135deg, rgba(133, 230, 255, 0.16), rgba(110, 84, 255, 0.16));
  color: var(--cyan);
  border: 1px solid rgba(133, 230, 255, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.ghost,
.icon-button {
  padding: 0 14px;
}

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

button:not(:disabled):hover {
  transform: translateY(-1px);
  border-color: rgba(221, 215, 254, 0.44);
  box-shadow: 0 12px 26px rgba(110, 84, 255, 0.18);
}

button:not(:disabled):hover::before {
  animation: button-shine 0.75s ease forwards;
}

button:not(:disabled):active {
  transform: translateY(1px) scale(0.99);
}

.panel {
  display: none;
  border-radius: 18px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  animation-delay: 0.16s;
}

.panel::before,
.quote-board::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--purple), var(--pink), var(--cyan));
  background-size: 220% 100%;
  opacity: 0.78;
  animation: border-flow 5s linear infinite;
}

.panel::after,
.quote-board::after {
  content: "";
  position: absolute;
  inset: 3px 0 auto;
  height: 80px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(133, 230, 255, 0.08), transparent);
}

.panel.is-active {
  display: block;
  animation: panel-pop 0.34s ease both;
}

.panel-head,
.quote-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

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

.form-grid.compact {
  grid-template-columns: 1.4fr 0.6fr;
}

.trade-grid {
  align-items: end;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

label span {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(221, 215, 254, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(110, 84, 255, 0.03)),
    var(--control);
  color: var(--text);
  padding: 0 14px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

input::placeholder {
  color: rgba(221, 215, 254, 0.52);
}

input:focus,
select:focus {
  border-color: rgba(133, 230, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(133, 230, 255, 0.1);
  transform: translateY(-1px);
}

input:hover,
select:hover {
  border-color: rgba(221, 215, 254, 0.38);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(110, 84, 255, 0.045)),
    var(--control);
}

.custom-token-drawer {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(133, 230, 255, 0.26);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(133, 230, 255, 0.1), rgba(110, 84, 255, 0.14)),
    rgba(4, 2, 13, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: drawer-open 0.24s ease both;
}

.trade-token-drawer {
  align-items: end;
}

.custom-token-input {
  border-color: rgba(133, 230, 255, 0.34);
  background:
    linear-gradient(135deg, rgba(133, 230, 255, 0.08), rgba(110, 84, 255, 0.1)),
    rgba(3, 1, 9, 0.62);
}

.custom-token-drawer p {
  margin: 0 0 4px;
  max-width: 220px;
  color: rgba(221, 215, 254, 0.7);
  font-size: 0.78rem;
  line-height: 1.35;
}

.custom-token-drawer .drawer-note {
  grid-column: 1 / -1;
  margin: -4px 0 0;
  max-width: none;
}

.trade-token-drawer .ghost {
  min-width: 116px;
  border-color: rgba(133, 230, 255, 0.3);
  color: var(--cyan);
  background: linear-gradient(135deg, rgba(133, 230, 255, 0.11), rgba(110, 84, 255, 0.12));
}

.is-custom-token select {
  border-color: rgba(133, 230, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(133, 230, 255, 0.08);
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.segmented {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.segment {
  min-width: 82px;
  background: transparent;
  padding: 0 12px;
  border: 1px solid transparent;
  font-weight: 900;
}

.trade-side-toggle {
  min-width: 188px;
}

.trade-side-toggle .segment {
  flex: 1;
}

.contract-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 16px;
}

.token-card {
  margin-top: 16px;
  padding: 16px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(110, 84, 255, 0.08)),
    rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.token-card strong {
  color: var(--text);
}

.token-card code {
  color: var(--lavender);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.quote-board {
  border-radius: 18px;
  padding: 20px;
  min-height: 500px;
  position: relative;
  overflow: hidden;
  animation-delay: 0.22s;
}

.quote-box {
  min-height: 210px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(110, 84, 255, 0.035)),
    rgba(0, 0, 0, 0.28);
  overflow-wrap: anywhere;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.route-line {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.route-line strong {
  font-size: 1.28rem;
}

.activity-log {
  margin-top: 14px;
  max-height: 220px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.log-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(221, 215, 254, 0.1);
  color: var(--muted);
  font-size: 0.86rem;
  animation: log-slide 0.22s ease both;
}

@keyframes grid-drift {
  from {
    background-position: 0 0, 0 0;
  }

  to {
    background-position: 46px 46px, 46px 46px;
  }
}

@keyframes surface-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes panel-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes hero-sweep {
  0%,
  100% {
    transform: translateX(-6%) rotate(-8deg);
    opacity: 0.48;
  }

  50% {
    transform: translateX(9%) rotate(-8deg);
    opacity: 0.78;
  }
}

@keyframes logo-float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

@keyframes button-shine {
  0% {
    left: -55%;
    opacity: 0;
  }

  20% {
    opacity: 0.75;
  }

  100% {
    left: 120%;
    opacity: 0;
  }
}

@keyframes border-flow {
  to {
    background-position: 220% 0;
  }
}

@keyframes drawer-open {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes log-slide {
  from {
    opacity: 0;
    transform: translateX(8px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.ok {
  color: var(--green);
}

.warn {
  color: var(--warn);
}

.bad {
  color: var(--bad);
}

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

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

  .quote-board {
    min-height: auto;
  }

  .tabs {
    width: 100%;
  }

  .panel-head {
    align-items: flex-start;
  }

  .primary,
  .secondary,
  .ghost,
  .icon-button {
    min-height: 46px;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1220px);
    padding: 12px 0 18px;
  }

  .brand-lockup,
  .wallet-card,
  .panel,
  .quote-board {
    border-radius: 14px;
  }

  .brand-lockup,
  .wallet-card,
  .panel {
    padding: 16px;
  }

  .panel-head {
    flex-direction: column;
  }

  .trade-side-toggle {
    width: 100%;
  }

  .brand-lockup {
    min-height: 292px;
    gap: 18px;
  }

  .brand-lockup img {
    width: 96px;
    border-radius: 18px;
  }

  h1 {
    font-size: clamp(2rem, 10.5vw, 3rem);
    line-height: 0.96;
  }

  .form-grid,
  .form-grid.compact,
  .contract-strip,
  .custom-token-drawer {
    grid-template-columns: 1fr;
  }

  .custom-token-drawer p {
    max-width: none;
  }

  .actions {
    flex-direction: column;
  }

  .actions button {
    width: 100%;
  }

  .tab {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 390px) {
  .shell {
    width: min(100% - 16px, 1220px);
  }

  .brand-lockup,
  .wallet-card,
  .panel,
  .quote-board {
    padding: 14px;
  }

  h1 {
    font-size: clamp(1.85rem, 10vw, 2.55rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
