:root {
  --cream: #f4ebdd; --paper: #fbf6ee; --espresso: #2b1d16; --cocoa: #5a4232; --mute: #8a7664;
  --terra: #c2552d; --terra-dark: #a3441f; --pine: #3f5d4a; --line: #e4d7c3; --gold: #d9a441;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --radius: 14px; --shadow: 0 1px 2px rgba(43,29,22,.06), 0 8px 24px rgba(43,29,22,.08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--espresso); font: 16px/1.5 var(--sans); min-height: 100dvh;
  background-image: radial-gradient(ellipse at top, #fbf4e6 0, var(--cream) 60%); }
body.no-scroll { overflow: hidden; }
a { color: var(--terra-dark); text-decoration-color: rgba(194,85,45,.35); text-underline-offset: 2px; }
.wrap { width: min(1120px, 100% - 2.5rem); margin: 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code { font: .85em ui-monospace, SFMono-Regular, Menlo, monospace; background: rgba(43,29,22,.06); padding: .1em .35em; border-radius: 5px; }
pre { background: var(--espresso); color: var(--cream); padding: .9rem 1rem; border-radius: 10px; overflow-x: auto; }
pre code { background: none; padding: 0; color: inherit; }

/* header */
.top { position: sticky; top: 0; z-index: 30; background: rgba(244,235,221,.85); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 50%; background: var(--espresso); color: var(--cream); display: grid; place-items: center; font-size: 18px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--serif); font-size: 1.15rem; letter-spacing: -.01em; }
.brand-text small { color: var(--mute); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.cart-btn { border: 0; background: var(--espresso); color: var(--cream); border-radius: 999px; padding: .5rem .9rem; font: 600 .85rem var(--sans); cursor: pointer; }

/* hero */
.hero { padding: 2.6rem 0 1.6rem; }
.hero h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.02; letter-spacing: -.02em; margin: 0 0 .9rem; max-width: 18ch; }
.lede { max-width: 56ch; color: var(--cocoa); margin: 0 0 .6rem; font-size: 1.02rem; }
.lede abbr { text-decoration: none; border-bottom: 1px dotted var(--mute); }
.testnet { display: inline-block; margin: 0; font-size: .78rem; letter-spacing: .02em; color: var(--pine); background: rgba(63,93,74,.1); border: 1px solid rgba(63,93,74,.25); padding: .25rem .6rem; border-radius: 999px; }

/* layout */
.layout { display: grid; gap: 1.25rem; padding-bottom: 2rem; }
.map { height: 44vh; min-height: 260px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); background: #e9e2d4; }
.leaflet-container { font: inherit; }
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--paper); border: 2px solid var(--espresso); display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .15s, background .15s; }
.pin span { transform: rotate(45deg); font-size: 14px; line-height: 1; }
.pin.is-active { background: var(--terra); border-color: var(--terra-dark); transform: rotate(-45deg) scale(1.18); }
.leaflet-tooltip { font: 600 .78rem var(--sans); border-radius: 8px; border-color: var(--line); color: var(--espresso); }
.recent { margin-top: 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.recent h2 { font: 600 .72rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); margin: 0 0 .5rem; }
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; justify-content: space-between; gap: 1rem; font-size: .85rem; padding: .3rem 0; border-top: 1px dashed var(--line); }
.recent li:first-child { border-top: 0; }
.recent li span:last-child { color: var(--mute); white-space: nowrap; }

.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1.5px solid var(--line); background: var(--paper); color: var(--cocoa); border-radius: 999px; padding: .5rem .9rem; font: 600 .82rem var(--sans); cursor: pointer; min-height: 40px; transition: .15s; }
.chip.is-on { background: var(--espresso); border-color: var(--espresso); color: var(--cream); }
.select select { appearance: none; -webkit-appearance: none; border: 1.5px solid var(--line); background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235a4232' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") no-repeat right .8rem center; border-radius: 999px; padding: .5rem 2.2rem .5rem .9rem; font: 600 .82rem var(--sans); color: var(--cocoa); min-height: 40px; }
.count { color: var(--mute); font-size: .82rem; margin: .8rem 0 .5rem; }

.vendors { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.vendor { display: grid; grid-template-columns: 44px 1fr auto; gap: .8rem; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem .95rem; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.vendor:hover, .vendor:focus-visible { border-color: #cdbba0; box-shadow: var(--shadow); outline: none; }
.vendor:active { transform: scale(.985); }
.v-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--cream); display: grid; place-items: center; font-size: 20px; }
.vendor h3 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 1.06rem; letter-spacing: -.01em; }
.v-meta { margin: .1rem 0 0; color: var(--mute); font-size: .8rem; }
.v-note { margin: .3rem 0 0; font-size: .8rem; color: var(--pine); font-style: italic; }
.v-price { text-align: right; color: var(--mute); font-size: .7rem; line-height: 1.1; }
.v-price strong { color: var(--espresso); font-size: 1rem; font-family: var(--serif); }

/* how */
.how { padding: 1.5rem 0 1rem; border-top: 1px solid var(--line); }
.how h2 { font-family: var(--serif); font-weight: 500; font-size: 1.5rem; letter-spacing: -.01em; margin: 0 0 .8rem; }
.steps { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--cocoa); font-size: .95rem; display: grid; gap: .45rem; max-width: 70ch; }
.agents { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1rem; margin: .6rem 0; font-size: .92rem; color: var(--cocoa); }
.agents summary { cursor: pointer; font-weight: 600; color: var(--espresso); }
.agents p { margin: .6rem 0; }
.foot { padding: 1.4rem 0 calc(2rem + env(safe-area-inset-bottom)); color: var(--mute); font-size: .8rem; }

/* sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(43,29,22,.45); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--paper); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(43,29,22,.25); max-height: 92dvh; display: flex; flex-direction: column; animation: up .22s ease-out; padding-bottom: env(safe-area-inset-bottom); }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: .6rem auto 0; }
.sheet-head { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 1.2rem .6rem; border-bottom: 1px solid var(--line); }
.sheet-kind { margin: 0; font: 600 .7rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--terra-dark); }
.sheet h2 { margin: .1rem 0; font-family: var(--serif); font-weight: 600; font-size: 1.45rem; letter-spacing: -.015em; }
.sheet-meta { margin: 0; color: var(--mute); font-size: .82rem; }
.icon-btn { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--cream); font-size: 22px; line-height: 1; cursor: pointer; color: var(--cocoa); }
.sheet-body { overflow-y: auto; padding: .4rem 1.2rem; }
.line { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 0; border-bottom: 1px dashed var(--line); }
.line:last-child { border-bottom: 0; }
.line-name { display: flex; flex-direction: column; font-weight: 500; }
.line-name small { color: var(--mute); font-weight: 400; font-size: .8rem; }
.line.has-qty .line-name { color: var(--terra-dark); }
.qty { display: flex; align-items: center; gap: .2rem; background: var(--cream); border-radius: 999px; padding: 2px; }
.qty button { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 50%; font-size: 20px; cursor: pointer; color: var(--espresso); }
.qty button:active { background: var(--line); }
.qty span { min-width: 1.6ch; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.sheet-foot { padding: .8rem 1.2rem 1rem; border-top: 1px solid var(--line); background: var(--paper); }
.total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .6rem; color: var(--cocoa); }
.total strong { font-family: var(--serif); font-size: 1.4rem; color: var(--espresso); }
.pay { width: 100%; min-height: 50px; border: 0; border-radius: 12px; background: var(--terra); color: #fff; font: 700 1rem var(--sans); cursor: pointer; transition: .15s; }
.pay:hover { background: var(--terra-dark); }
.pay:active { transform: scale(.985); }
.pay:disabled { background: #d9c9b3; color: #fff; cursor: not-allowed; }
.pay.is-busy { background: var(--cocoa); position: relative; }
.pay.is-busy::after { content: ""; position: absolute; right: 14px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pay-status { min-height: 1.2em; margin: .5rem 0 0; font-size: .85rem; color: var(--cocoa); }
.wallet-links { margin-top: .5rem; font-size: .85rem; color: var(--cocoa); display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.wallet-links p { width: 100%; margin: 0; }
.wallet-links a, .link-btn { border: 1.5px solid var(--line); background: var(--cream); color: var(--espresso); padding: .5rem .8rem; border-radius: 999px; text-decoration: none; font: 600 .82rem var(--sans); cursor: pointer; }

/* ticket */
.ticket-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(43,29,22,.55); display: grid; place-items: center; padding: 1rem; }
.ticket { position: relative; width: min(420px, 100%); background: #fff; color: var(--espresso); border-radius: 6px; padding: 1.6rem 1.4rem 1.2rem; box-shadow: 0 20px 60px rgba(0,0,0,.35); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem;
  -webkit-mask: radial-gradient(circle at 10px 50%, transparent 7px, #000 7.5px) -10px 0 / 100% 100%; mask: radial-gradient(circle at 10px 50%, transparent 7px, #000 7.5px) -10px 0 / 100% 100%; }
.ticket::before, .ticket::after { content: ""; position: absolute; left: 0; right: 0; height: 8px; background: radial-gradient(circle, transparent 5px, #fff 5.5px) 0 0 / 16px 16px; }
.ticket::before { top: -8px; } .ticket::after { bottom: -8px; transform: rotate(180deg); }
.ticket-close { position: absolute; top: .6rem; right: .6rem; width: 34px; height: 34px; font-size: 18px; }
.t-kicker { margin: 0; letter-spacing: .14em; text-transform: uppercase; font-size: .7rem; color: var(--pine); }
.ticket h2 { font-family: var(--serif); font-size: 1.5rem; margin: .2rem 0; letter-spacing: -.01em; }
.t-meta { margin: 0 0 1rem; color: var(--mute); }
.t-code { text-align: center; border: 2px dashed var(--line); border-radius: 8px; padding: .8rem; margin-bottom: 1rem; }
.t-code span { display: block; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.t-code strong { font-size: 2.4rem; letter-spacing: .25em; font-family: var(--serif); }
.t-lines { list-style: none; margin: 0; padding: 0; border-top: 1px dashed var(--line); }
.t-lines li { display: flex; justify-content: space-between; padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.t-total { display: flex; justify-content: space-between; margin: .6rem 0; font-size: 1rem; }
.t-tx, .t-link { margin: .4rem 0; } .t-note { color: var(--mute); margin: .6rem 0 0; font-size: .75rem; }

@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .map-col { position: sticky; top: 74px; }
  .map { height: calc(100dvh - 74px - 1.5rem); min-height: 420px; max-height: 760px; }
  .sheet { left: auto; right: 2rem; bottom: 1.5rem; width: 440px; border-radius: 22px; max-height: calc(100dvh - 3rem); }
  .sheet-grip { display: none; }
  .hero { padding: 3.5rem 0 2rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
