/* Theme aligned with anoncoin.it palette (dark base, cyan + electric purple, gold/pink accents) */

:root {
  --bg-deep: #0b0f17;
  --bg-mid: #0c0f14;
  --bg-card: rgba(14, 17, 24, 0.78);
  --bg-card-solid: #0e1118;
  --border: rgba(56, 255, 222, 0.14);
  --border-strong: rgba(76, 64, 236, 0.45);
  --accent-cyan: #38ffde;
  --accent-purple: #4c40ec;
  --accent-violet: #241f66;
  --accent-gold: #f3ce28;
  --accent-pink: #fab6f4;
  --text: #ecebf0;
  --text-muted: rgba(236, 235, 240, 0.58);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-glow: 0 0 48px rgba(56, 255, 222, 0.06), 0 0 80px rgba(76, 64, 236, 0.08);
  --font-display: "Caveat", cursive;
  --font-ui: "DM Sans", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -30%, rgba(76, 64, 236, 0.22), transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 50%, rgba(36, 31, 102, 0.35), transparent 45%),
    radial-gradient(ellipse 70% 45% at 0% 80%, rgba(56, 255, 222, 0.06), transparent 40%),
    linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-deep) 45%, #06080d 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  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.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 1;
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: grid;
  gap: 20px;
}

/* Top bar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-glow);
}

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

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid rgba(56, 255, 222, 0.25);
  box-shadow:
    0 0 0 1px rgba(76, 64, 236, 0.2),
    0 12px 32px rgba(0, 0, 0, 0.45);
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 4px;
  background: linear-gradient(120deg, var(--text) 0%, var(--accent-cyan) 55%, var(--accent-pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.15;
}

.brand-text p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.35;
  max-width: 420px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bg-deep);
  background: linear-gradient(105deg, var(--accent-gold), #ffe566);
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 8px;
  box-shadow: 0 2px 12px rgba(243, 206, 40, 0.25);
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-purple);
  box-shadow: 0 0 8px var(--accent-cyan);
}

#wallet-status {
  color: var(--accent-cyan);
  font-weight: 600;
}

.swap-wallet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: -4px 0 14px;
}

.swap-wallet #wallet-status {
  font-size: 0.84rem;
}

/* Centered swap column */
.swap-layout {
  display: flex;
  justify-content: center;
  width: 100%;
}

.card--swap {
  width: 100%;
  max-width: 520px;
  padding: 18px 18px 20px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 22px 22px 24px;
  box-shadow: var(--shadow-glow);
}

.card h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text);
  letter-spacing: 0.03em;
}

.swap-route-field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.swap-route-select {
  width: 100%;
  border: 1px solid rgba(236, 235, 240, 0.14);
  border-radius: var(--radius-md);
  background: rgba(5, 7, 11, 0.65);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2338ffde' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.swap-route-select:hover {
  border-color: rgba(56, 255, 222, 0.25);
}

.swap-route-select:focus {
  outline: none;
  border-color: rgba(56, 255, 222, 0.55);
  box-shadow: 0 0 0 3px rgba(76, 64, 236, 0.25);
}

/* Tabs */
.row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.tab {
  flex: 1;
  min-width: 140px;
  border: 1px solid rgba(236, 235, 240, 0.12);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-muted);
  padding: 11px 14px;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  transition:
    border-color 0.2s,
    background 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}

.tab:hover {
  border-color: rgba(56, 255, 222, 0.35);
  color: var(--text);
}

.tab.active {
  border-color: rgba(56, 255, 222, 0.55);
  color: var(--text);
  background: linear-gradient(145deg, rgba(76, 64, 236, 0.35), rgba(56, 255, 222, 0.12));
  box-shadow:
    0 0 24px rgba(76, 64, 236, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Form */
label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

label.field-with-action .field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

label.field-with-action .field-label-row span:first-child {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

input {
  border: 1px solid rgba(236, 235, 240, 0.14);
  border-radius: var(--radius-md);
  background: rgba(5, 7, 11, 0.65);
  color: var(--text);
  padding: 13px 14px;
  font: inherit;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

input:hover {
  border-color: rgba(56, 255, 222, 0.25);
}

input:focus {
  outline: none;
  border-color: rgba(56, 255, 222, 0.55);
  box-shadow: 0 0 0 3px rgba(76, 64, 236, 0.25);
}

.summary {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 12px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(236, 235, 240, 0.08);
  background: rgba(0, 0, 0, 0.2);
}

.summary-row {
  display: grid;
  border-bottom: 1px solid rgba(236, 235, 240, 0.06);
}

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

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

.summary-row:last-child {
  border-bottom: none;
}

.summary-cell {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px;
  font-size: 0.8rem;
  min-width: 0;
}

.summary-row--2 .summary-cell:first-child {
  border-right: 1px solid rgba(236, 235, 240, 0.06);
}

.summary-cell span:first-child {
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.summary-cell span:last-child {
  color: var(--text);
  font-weight: 600;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-details {
  border-bottom: 1px solid rgba(236, 235, 240, 0.06);
}

.summary-details:last-child {
  border-bottom: none;
}

.summary-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: rgba(56, 255, 222, 0.05);
  user-select: none;
}

.summary-details > summary::-webkit-details-marker {
  display: none;
}

.summary-details > summary::after {
  content: "▸";
  float: right;
  font-size: 0.65rem;
  opacity: 0.7;
}

.summary-details[open] > summary::after {
  content: "▾";
}

.summary-details-body .summary-row {
  border-bottom: 1px solid rgba(236, 235, 240, 0.05);
}

.summary-details-body .summary-row:last-child {
  border-bottom: none;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #0b0f17;
  background: linear-gradient(115deg, var(--accent-cyan), #7efff0 40%, var(--accent-purple));
  background-size: 120% 120%;
  box-shadow:
    0 4px 20px rgba(56, 255, 222, 0.25),
    0 2px 8px rgba(76, 64, 236, 0.35);
  transition:
    transform 0.15s,
    filter 0.15s,
    box-shadow 0.15s;
}

.btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow:
    0 8px 28px rgba(56, 255, 222, 0.3),
    0 4px 12px rgba(76, 64, 236, 0.4);
}

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

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(56, 255, 222, 0.35);
  box-shadow: none;
}

.btn.ghost:hover {
  background: rgba(56, 255, 222, 0.08);
  border-color: rgba(56, 255, 222, 0.5);
}

.btn.sm {
  padding: 6px 14px;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.82em;
}

pre {
  margin: 18px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid rgba(56, 255, 222, 0.12);
  border-radius: var(--radius-md);
  padding: 14px;
  background: rgba(5, 7, 11, 0.75);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.78rem;
  color: rgba(236, 235, 240, 0.88);
  line-height: 1.5;
}

.output-log {
  max-height: 11rem;
  overflow-y: auto;
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 0.74rem;
}

.hidden {
  display: none !important;
}

/* Success modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 8, 14, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.28s ease,
    visibility 0.28s ease;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(56, 255, 222, 0.22);
  background: linear-gradient(165deg, rgba(18, 22, 32, 0.97) 0%, rgba(10, 12, 18, 0.98) 100%);
  box-shadow:
    0 0 0 1px rgba(76, 64, 236, 0.15),
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(56, 255, 222, 0.08);
  padding: 28px 24px 22px;
  transform: scale(0.94) translateY(16px);
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.32s ease;
}

.modal-overlay.is-open .modal-card {
  transform: scale(1) translateY(0);
}

.modal-card--success::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(56, 255, 222, 0.35), rgba(76, 64, 236, 0.25), transparent 55%);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color 0.15s,
    background 0.15s;
}

.modal-close:hover {
  color: var(--text);
  background: rgba(56, 255, 222, 0.12);
}

.modal-success-badge {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b0f17;
  background: linear-gradient(140deg, var(--accent-cyan), #8dfff0 45%, var(--accent-purple));
  box-shadow:
    0 0 32px rgba(56, 255, 222, 0.35),
    0 8px 24px rgba(76, 64, 236, 0.35);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 6px;
  letter-spacing: 0.02em;
  background: linear-gradient(120deg, var(--text) 0%, var(--accent-cyan) 50%, var(--accent-pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-sub {
  text-align: center;
  margin: 0 0 22px;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.modal-details {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(236, 235, 240, 0.08);
  margin-bottom: 16px;
}

.modal-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 11px 14px;
  font-size: 0.86rem;
  border-bottom: 1px solid rgba(236, 235, 240, 0.06);
  background: rgba(0, 0, 0, 0.2);
}

.modal-detail-row:last-child {
  border-bottom: none;
}

.modal-detail-row--highlight {
  background: rgba(56, 255, 222, 0.06);
}

.modal-detail-row--highlight .modal-detail-value {
  color: var(--accent-cyan);
  font-weight: 700;
}

.modal-detail-label {
  color: var(--text-muted);
  font-weight: 500;
}

.modal-detail-value {
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.modal-sig {
  margin-bottom: 18px;
}

.modal-sig .modal-detail-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.modal-sig-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-sig-code {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.72rem;
  color: rgba(236, 235, 240, 0.9);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(5, 7, 11, 0.85);
  border: 1px solid rgba(56, 255, 222, 0.12);
  word-break: break-all;
  line-height: 1.4;
}

.modal-footer-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-btn-primary {
  text-decoration: none;
  width: 100%;
}

.modal-footer-btns .btn.ghost {
  width: 100%;
}

.footer-hint {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 8px 0 0;
}

.footer-hint a {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
}

.footer-hint a:hover {
  text-decoration: underline;
}

.footer-hint--fine {
  font-size: 0.72rem;
  opacity: 0.92;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.45;
}

.footer-built-on {
  display: flex;
  justify-content: center;
  padding: 28px 16px 8px;
  margin-top: 8px;
}

.footer-built-on__link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-muted);
  transition:
    color 0.2s,
    filter 0.2s;
}

.footer-built-on__link:hover {
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 12px rgba(56, 255, 222, 0.25));
}

.footer-built-on__logo {
  width: 44px;
  height: auto;
  max-height: 44px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid rgba(56, 255, 222, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.footer-built-on__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .shell {
    max-width: 100%;
  }

  .swap-wallet .btn.sm {
    flex: 1;
    min-width: 120px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    transition: none !important;
  }
}
