@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,600;0,9..40,700;1,9..40,400&family=Outfit:wght@600;700;800&display=swap");

:root {
  --paper: #f7f2ea;
  --paper-2: #fbf8f3;
  --card: #fffefb;
  --wood: #ebdcc7;
  --wood-2: #e2cdb2;
  --ink: #27231f;
  --ink-2: #6e665d;
  --ink-3: #736a60;
  --line: #27231f17;
  --line-2: #27231f29;
  --accent: #f2584f;
  --accent-ink: #cc6629;
  --accent-soft: #fde1df;
  --butter: #f6d77a;
  --blue: #7f9cc3;
  --danger: #a03a16;
  --success: #3fa36b;
  --ff-display: "Outfit", system-ui, sans-serif;
  --ff-body: "DM Sans", system-ui, sans-serif;
  --ff-mono: "DM Mono", ui-monospace, monospace;
  --r: 30px;
  --shadow-soft: 0 30px 60px -30px #46321e4d, 0 10px 24px -12px #46321e24;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --gutter: clamp(16px, 4vw, 56px);
  --side: 248px;
  --tabbar: 0px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
html.menu-open { overflow: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ff-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(900px 600px at 10% -10%, #ffffffe6, transparent 60%),
    radial-gradient(900px 600px at 100% 10%, #f6d77a29, transparent 60%),
    radial-gradient(700px 500px at 50% 100%, #7f9cc31a, transparent 60%);
}
h1, h2, h3 {
  font-family: var(--ff-display);
  letter-spacing: -0.035em;
  margin: 0;
  font-weight: 700;
  line-height: 1.05;
}
p { margin: 0; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
img, svg { display: block; }

.skip-link {
  position: absolute;
  top: -60px;
  left: 12px;
  z-index: 100;
  background: var(--ink);
  color: var(--paper-2);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.app { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
.app-main { min-width: 0; flex: 1; display: flex; flex-direction: column; padding-bottom: var(--tabbar); }
.app-main > main { flex: 1; animation: route-in 0.32s var(--ease); }
@keyframes route-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.sidebar { display: none; }
.side-in {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 16px 18px;
  overflow-y: auto;
  scrollbar-width: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: 25px;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--ink);
}
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-link {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 15.5px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.3s var(--spring);
}
.side-link svg { width: 21px; height: 21px; flex: none; }
.side-link:hover { color: var(--ink); background: #27231f0f; }
.side-link[aria-current="page"] { background: var(--ink); color: var(--paper-2); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.side-foot p { color: var(--ink-3); font-size: 12.5px; line-height: 1.45; padding: 0 6px; }

.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 calc(var(--gutter) - 6px) 0 var(--gutter);
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
}
.topbar .brand { font-size: 22px; }
.more-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
}
.more-btn svg { width: 22px; height: 22px; }
.more-btn:hover { background: #27231f12; }

.tabbar { display: none; }
.more-veil {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #1e22305c;
}
.more-sheet {
  position: fixed;
  z-index: 89;
  left: 10px;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 18px 22px;
  background: var(--card);
  border-radius: 28px;
  box-shadow: 0 24px 50px -20px #27231f73;
}
.more-sheet nav { display: flex; flex-direction: column; }
.more-sheet nav a {
  border-bottom: 1px solid var(--line);
  padding: 14px 4px;
  font-family: var(--ff-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.more-sheet nav a:last-child { border-bottom: 0; }
.more-sheet nav a[aria-current="page"] { color: var(--accent); }
.legal { color: var(--ink-2); font-size: 13px; line-height: 1.45; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter); }
.page { padding-top: clamp(8px, 2vw, 28px); padding-bottom: 28px; }
.page-head, .hero {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 40em;
  margin-bottom: 22px;
}
.hero h1, .page-head h1 {
  font-size: clamp(34px, 4.8vw, 56px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.02;
}
.hero h1 { font-size: clamp(42px, 5.4vw, 72px); }
.accent { color: var(--accent-ink); }
.eyebrow {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
}
.lede { color: var(--ink-2); max-width: 34em; font-size: clamp(17px, 1.4vw, 20px); text-wrap: pretty; }
.sub { color: var(--ink-2); font-size: 17px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #27231f0f;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.3s var(--spring);
}
.chip-btn:hover { color: var(--ink); transform: translateY(-1px); }
.chip-btn.on, .chip-btn[aria-current="page"] { background: var(--ink); color: var(--paper-2); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 7px 13px;
  border-radius: 999px;
  background: #27231f0f;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.pill .dot, .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.dot.ok { background: var(--success); box-shadow: 0 0 0 3px #3fa36b29; }

button.solid,
#go,
#tx-go,
#allowance-sign,
#allowance-authorize,
.toolbar.wallet button,
td button {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper-2);
  font-weight: 700;
  transition: transform 0.35s var(--spring), opacity 0.2s;
}
button.solid:hover,
#go:hover,
#tx-go:hover,
.toolbar.wallet button:hover,
td button:hover { transform: translateY(-1px); }
button:disabled { opacity: 0.55; cursor: wait; }
#tx-cancel,
#allowance-close,
.pager button {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  box-shadow: inset 0 0 0 2px var(--line-2);
}
body.page-close #tx-go { background: var(--danger); color: #fff; }

input, textarea, select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 0;
  border-radius: 16px;
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line-2);
}
textarea { resize: vertical; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat {
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow-soft), inset 0 0 0 1px #ffffffb3;
  padding: 16px 18px;
  min-width: 0;
}
.stat span {
  display: block;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.stat strong {
  display: block;
  margin-top: 8px;
  font-family: var(--ff-display);
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.note, .account, .warn, .empty { margin-top: 12px; color: var(--ink-2); }
.account { font-family: var(--ff-mono); font-size: 14px; overflow-wrap: anywhere; }
.callout {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--ink);
}
.tool-section { margin-top: 28px; }
.tool-section h2 { font-size: clamp(26px, 2.6vw, 34px); margin-bottom: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.toolbar input { flex: 1 1 16rem; border-radius: 999px; background: var(--card); }
.muted { color: var(--ink-3); font-family: var(--ff-mono); font-size: 13px; overflow-wrap: anywhere; }
td, dd, .account { overflow-wrap: anywhere; }
.nft { display: flex; align-items: center; gap: 12px; min-width: 0; }
.nft-copy { min-width: 0; display: grid; gap: 2px; }
.nft a { font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.nft a:hover { text-decoration: underline; }
.thumb {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 16px;
  background: var(--wood);
  overflow: hidden;
}
.thumb img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  opacity: 0;
}
.thumb img.is-ready { opacity: 1; }
.gift {
  display: grid;
  gap: 12px;
  margin: 18px 0 4px;
  padding: 16px 18px;
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow-soft), inset 0 0 0 1px #ffffffb3;
}
.gift p { color: var(--ink-2); }
.gift-addr {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--ff-mono);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.gift-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.gift-row input { width: 9.5rem; flex: 0 1 9.5rem; }
.gift-copy {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  box-shadow: inset 0 0 0 1.5px var(--line-2);
}
.gift-status a { font-weight: 700; }
.x-link {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
  flex: none;
}
.x-link svg { width: 16px; height: 16px; }
.x-link:hover { color: var(--ink); background: #27231f0f; }
.side-foot .x-link { align-self: flex-start; }

.table-wrap {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow-soft), inset 0 0 0 1px #ffffffb3;
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; min-width: 68rem; }
th, td {
  text-align: left;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  color: var(--ink-3);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}
td { font-size: 15px; }
td button { white-space: nowrap; }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 12px; color: var(--ink-2); }

dialog {
  width: min(34rem, calc(100% - 20px));
  padding: 22px;
  border: 0;
  border-radius: 28px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 30px 60px -24px #46321e73;
}
dialog::backdrop { background: #1e22305c; }
dialog h2 { font-size: clamp(26px, 3vw, 34px); margin-bottom: 8px; }
dialog p { margin-top: 8px; color: var(--ink-2); }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; margin: 16px 0 0; padding: 0; }
dl { display: grid; grid-template-columns: 8.5rem 1fr; gap: 8px 12px; margin: 12px 0; }
dt { color: var(--ink-3); font-size: 13px; font-weight: 700; }
dd { margin: 0; overflow-wrap: anywhere; font-family: var(--ff-mono); font-size: 13px; }
.tip { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; color: var(--ink-2); }
.tip input { width: auto; min-height: 0; margin-top: 4px; accent-color: var(--ink); box-shadow: none; }
.steps { counter-reset: step; list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.steps li {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ink-2);
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--wood);
  color: var(--ink);
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 14px;
  flex: none;
}
.steps li.now { color: var(--ink); font-weight: 700; }
.steps li.now::before { background: var(--ink); color: var(--paper-2); }

.foot {
  position: relative;
  z-index: 1;
  margin-top: 28px;
  padding: 28px 0 calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.foot .wrap { display: flex; flex-direction: column; gap: 14px; }
.foot .row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 16px; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.foot-nav a { font-weight: 700; text-decoration: none; color: var(--ink-2); }
.foot-nav a:hover, .foot-nav a[aria-current="page"] { color: var(--ink); }

@media (max-width: 1023px) {
  :root { --tabbar: calc(128px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    position: fixed;
    z-index: 60;
    left: 50%;
    bottom: calc(14px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(400px, calc(100% - 32px));
    padding: 7px;
    background: var(--card);
    border-radius: 999px;
    box-shadow: 0 18px 40px -16px #27231f73, 0 0 0 1px #27231f0f;
  }
  .tab {
    height: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    border-radius: 999px;
    color: var(--ink-2);
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
  }
  .tab svg { width: 20px; height: 20px; }
  .tab[aria-current="page"] { background: var(--ink); color: var(--paper-2); }
}

@media (min-width: 1024px) {
  .sidebar {
    display: block;
    position: fixed;
    z-index: 40;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--side);
    background: var(--paper-2);
    border-right: 1px solid var(--line);
  }
  .app-main { margin-left: var(--side); }
  .topbar, .tabbar { display: none; }
  .more-veil, .more-sheet { display: none !important; }
}

@media (max-width: 800px) {
  .stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .table-wrap {
    overflow: visible;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }
  table, thead, tbody, tr, td { min-width: 0; }
  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  tr {
    display: grid;
    gap: 8px;
    margin: 0 0 12px;
    padding: 16px 18px;
    background: var(--card);
    border-radius: 24px;
    box-shadow: var(--shadow-soft), inset 0 0 0 1px #ffffffb3;
  }
  td {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    align-items: start;
    padding: 0;
    border: 0;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  td::before {
    content: attr(data-label);
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  td:not([data-label]) { grid-template-columns: 1fr; }
  td:not([data-label])::before { content: none; }
  td button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .app-main > main,
  .side-link,
  .chip-btn,
  button.solid,
  #go,
  #tx-go { animation: none; transition: none; }
}
