@font-face {
  font-family: "Bricolage";
  src: url("./assets/fonts/bricolage-400.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Bricolage";
  src: url("./assets/fonts/bricolage-600.ttf") format("truetype");
  font-weight: 600 800;
  font-display: swap;
}

@font-face {
  font-family: "National Park";
  src: url("./assets/fonts/national-park-regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "National Park";
  src: url("./assets/fonts/national-park-bold.ttf") format("truetype");
  font-weight: 600 800;
  font-display: swap;
}

:root {
  --page: #09090a;
  --panel: #121214;
  --field: #1a1a1d;
  --field-hover: #202024;
  --line: #303034;
  --line-strong: #4b4b51;
  --text: #f6f1e8;
  --muted: #aaa39a;
  --faint: #777169;
  --accent: #ff6a21;
  --accent-hover: #ff7c39;
  --accent-ink: #170b05;
  --focus: rgba(255, 106, 33, 0.34);
  --display: "Bricolage", ui-sans-serif, system-ui, sans-serif;
  --body: "National Park", ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--text);
  background: var(--page);
  font-family: var(--body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.dialog-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 24px 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--display);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.beta-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
}

.page {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 44px 18px 72px;
}

.hero {
  margin: 0 auto 30px;
  text-align: center;
  animation: settle 520ms var(--ease) both;
}

.hero h1 {
  max-width: 12ch;
  margin: 0 auto;
  color: var(--text);
  font-family: var(--display);
  font-size: clamp(42px, 9vw, 70px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero p {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 600;
}

.swap-card {
  position: relative;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.42);
  animation: settle 620ms var(--ease) 70ms both;
}

.asset-field {
  min-height: 140px;
  padding: 20px;
  background: var(--field);
  border: 1px solid transparent;
  border-radius: 22px;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.asset-field:hover {
  background: var(--field-hover);
}

.asset-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus);
}

.asset-field label,
.field-label {
  display: block;
  margin-bottom: 17px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
}

.asset-field-main {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

#amount,
#quote-output {
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-family: var(--display);
  font-size: clamp(38px, 8vw, 56px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.055em;
  text-overflow: ellipsis;
}

#amount::selection {
  color: var(--accent-ink);
  background: var(--accent);
}

#quote-output {
  display: block;
  overflow: hidden;
  white-space: nowrap;
}

.asset-button {
  min-width: 160px;
  min-height: 72px;
  padding: 8px 14px 8px 9px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms var(--ease);
}

.asset-button:hover {
  background: #26262a;
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.asset-button:active {
  transform: scale(0.98);
}

.asset-button img {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 50%;
}

.asset-button span {
  min-width: 0;
  max-width: 86px;
  overflow: hidden;
  color: var(--text);
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-button svg {
  width: 18px;
  height: 18px;
  margin-left: auto;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flip-button {
  position: relative;
  z-index: 2;
  width: 52px;
  height: 52px;
  margin: -12px auto;
  display: grid;
  place-items: center;
  color: var(--text);
  background: var(--panel);
  border: 5px solid var(--panel);
  border-radius: 17px;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, transform 220ms var(--ease);
}

.flip-button:hover {
  color: var(--accent-ink);
  background: var(--accent);
  transform: rotate(90deg);
}

.flip-button:active {
  transform: rotate(90deg) scale(0.94);
}

.flip-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route-summary {
  min-height: 72px;
  margin: 14px 2px 0;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.route-summary.is-updated {
  animation: route-bump 380ms var(--ease);
}

.provider-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #242428;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.provider-mark img {
  width: 100%;
  height: 100%;
  padding: 4px;
  object-fit: contain;
  border-radius: 50%;
}

.provider-mark.is-loading {
  border-color: var(--accent);
}

.route-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.route-copy > span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.route-copy strong {
  overflow: hidden;
  color: var(--text);
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-rate {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  color: var(--muted);
  background: var(--field);
  border-radius: 999px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.route-rate:empty {
  display: none;
}

.primary-action {
  width: 100%;
  min-height: 62px;
  margin-top: 12px;
  padding: 0 20px;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 800;
  transition: background-color 160ms ease, transform 180ms var(--ease);
}

.primary-action:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.primary-action:active:not(:disabled) {
  transform: scale(0.985);
}

.primary-action:disabled {
  color: var(--faint);
  background: #242428;
  cursor: not-allowed;
}

.release-note {
  margin: 13px 0 1px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

.dialog-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.76);
  opacity: 0;
  transition: opacity 180ms ease;
}

.dialog-layer.is-open {
  opacity: 1;
}

.dialog-panel {
  width: min(620px, 100%);
  max-height: min(760px, calc(100dvh - 40px));
  padding: 18px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.66);
  transform: translateY(16px) scale(0.985);
  transition: transform 220ms var(--ease);
}

.dialog-layer.is-open .dialog-panel {
  transform: none;
}

.dialog-header {
  min-height: 54px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-header h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--display);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.dialog-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.close-button {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.close-button:hover {
  background: var(--field-hover);
  border-color: var(--line-strong);
}

.close-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.search-field {
  min-height: 58px;
  margin-bottom: 12px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus);
}

.search-field svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-field input {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 17px;
}

.search-field input::placeholder {
  color: var(--faint);
}

.asset-list,
.route-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

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

.asset-option {
  min-width: 0;
  min-height: 72px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.asset-option:hover {
  background: var(--field);
  border-color: var(--line);
}

.asset-option img {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 50%;
}

.asset-option > span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.asset-option strong,
.asset-option > span > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-option strong {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
}

.asset-option > span > span {
  color: var(--muted);
  font-size: 14px;
}

.route-list {
  display: grid;
  gap: 8px;
}

.route-option {
  min-width: 0;
  min-height: 82px;
  padding: 12px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  color: var(--text);
  background: var(--field);
  border: 1px solid transparent;
  border-radius: 18px;
  cursor: pointer;
  text-align: left;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms var(--ease);
}

.route-option:hover {
  background: var(--field-hover);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.route-option.is-selected {
  border-color: var(--accent);
}

.route-option-copy,
.route-option-amount {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.route-option-copy strong,
.route-option-amount strong {
  overflow: hidden;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-option-copy > span,
.route-option-amount > span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.route-option-amount {
  justify-items: end;
}

.highest-badge {
  color: var(--accent) !important;
}

.drawer-note,
.empty-state {
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.drawer-note {
  margin: 14px 0 0;
}

.empty-state {
  margin: 28px 10px;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes route-bump {
  0% {
    border-color: var(--line);
    transform: none;
  }
  45% {
    border-color: var(--accent);
    transform: translateY(-2px);
  }
  100% {
    border-color: var(--line);
    transform: none;
  }
}

@media (max-width: 620px) {
  .site-header {
    padding-top: 16px;
  }

  .page {
    padding-top: 32px;
  }

  .hero {
    margin-bottom: 24px;
  }

  .hero p {
    margin-top: 12px;
  }

  .dialog-layer {
    padding: 0;
    place-items: end center;
  }

  .dialog-panel {
    width: 100%;
    max-height: min(82dvh, 760px);
    padding: 16px;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 26px 26px 0 0;
    transform: translateY(32px);
  }

  .asset-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .site-header {
    padding-right: 16px;
    padding-left: 16px;
  }

  .page {
    padding-right: 10px;
    padding-left: 10px;
  }

  .swap-card {
    padding: 9px;
    border-radius: 24px;
  }

  .asset-field {
    min-height: 128px;
    padding: 17px 14px;
    border-radius: 19px;
  }

  .asset-field-main {
    gap: 8px;
  }

  #amount,
  #quote-output {
    font-size: 38px;
  }

  .asset-button {
    min-width: 128px;
    min-height: 60px;
    padding-right: 11px;
    gap: 8px;
  }

  .asset-button img {
    width: 44px;
    height: 44px;
  }

  .asset-button span {
    max-width: 64px;
    font-size: 19px;
  }

  .route-summary {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    padding-right: 11px;
    padding-left: 11px;
    gap: 10px;
  }

  .provider-mark {
    width: 42px;
    height: 42px;
  }

  .route-rate {
    padding: 0 9px;
  }

  .route-option {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 9px;
  }
}

@media (max-width: 350px) {
  .asset-field-main {
    grid-template-columns: minmax(0, 1fr) 120px;
  }

  .asset-button {
    min-width: 120px;
    padding-right: 9px;
    gap: 6px;
  }

  .asset-button span {
    max-width: 62px;
  }

  .asset-button svg {
    display: none;
  }

  .route-rate {
    display: none;
  }
}

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

/* --- ZEC swap sandbox (local mock only) --- */

.sandbox-panel {
  width: 100%;
  margin-top: 26px;
  padding: 22px;
  display: grid;
  gap: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.42);
}

.sandbox-header {
  display: grid;
  gap: 10px;
}

.sandbox-header h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.sandbox-mock-banner {
  margin: 0;
  padding: 10px 14px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
}

#sandbox-form {
  display: grid;
  gap: 16px;
}

.sandbox-direction {
  margin: 0;
  padding: 16px;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.sandbox-direction legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.direction-option {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}

.direction-option input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--accent);
}

.direction-option input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sandbox-field {
  display: grid;
  gap: 8px;
}

.sandbox-field label {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.sandbox-field input {
  min-width: 0;
  min-height: 52px;
  padding: 12px 16px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 17px;
}

.sandbox-field input:hover {
  background: var(--field-hover);
}

.sandbox-field input:focus-visible {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 4px var(--focus);
}

.sandbox-action {
  min-height: 56px;
  padding: 14px 20px;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 16px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms var(--ease);
}

.sandbox-action:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.sandbox-action:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.sandbox-action:disabled {
  color: var(--faint);
  background: var(--field);
  cursor: progress;
  transform: none;
}

.sandbox-quote,
.sandbox-order {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.sandbox-quote h3,
.sandbox-order h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
}

.sandbox-totals {
  margin: 0;
  display: grid;
  gap: 10px;
}

.sandbox-totals > div {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.sandbox-totals dt {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.sandbox-totals dd {
  min-width: 0;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: right;
}

.sandbox-disclosure {
  margin: 0;
  padding: 12px 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  font-size: 14.5px;
  line-height: 1.5;
}

.sandbox-deposit {
  margin: 0;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.sandbox-timeline {
  margin: 0;
  padding: 0 0 0 22px;
  display: grid;
  gap: 8px;
}

.sandbox-step {
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.sandbox-step::marker {
  color: var(--accent);
  font-weight: 700;
}

.sandbox-outcome {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.sandbox-receipt {
  max-height: 320px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: var(--text);
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sandbox-error {
  margin: 0;
  padding: 12px 14px;
  color: #ffb1a1;
  background: rgba(211, 63, 32, 0.14);
  border: 1px solid rgba(255, 118, 84, 0.5);
  border-radius: 12px;
  font-size: 15px;
  overflow-wrap: anywhere;
}

@media (max-width: 430px) {
  .sandbox-panel {
    padding: 16px 14px;
    border-radius: 24px;
  }

  .sandbox-quote,
  .sandbox-order {
    padding: 14px 12px;
  }

  .sandbox-totals > div {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .sandbox-totals dd {
    text-align: left;
  }
}
