:root {
  color-scheme: dark;
  font: 16px/1.45 Inter, "Segoe UI", Arial, sans-serif;
  --bg: #080809;
  --surface: #151517;
  --raised: #202023;
  --line: #2b2b2f;
  --text: #f3f3f5;
  --muted: #a2a2ac;
  --blue: #89abff;
  --green: #62dba1;
  --red: #ff9197;
  --amber: #dfbc78;
  background: var(--bg);
  color: var(--text);
}
* { box-sizing: border-box; }
body, h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
input, select { min-width: 0; }
button, a, input, select, summary { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }
a { color: var(--blue); text-underline-offset: .2em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); }
.visually-hidden:focus-visible { clip-path: none; width: auto; height: auto; margin: 0; background: var(--surface); z-index: 1; }
.wrap { width: min(1120px, calc(100% - 5rem)); margin-inline: auto; }
.mast { border-bottom: 1px solid var(--line); }
.mast-inner { min-height: 66px; display: flex; align-items: center; gap: 3.25rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-size: 1.18rem; font-weight: 700; letter-spacing: -.045em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: #f0f1f5; color: #101013; font: bold 23px/1 Arial, sans-serif; }
.mast nav { display: flex; gap: 1.65rem; align-self: stretch; }
.mast [role=tab] { position: relative; padding: .3rem 0; color: var(--muted); font-size: .92rem; font-weight: 550; }
.mast [aria-selected=true] { color: var(--text); }
.mast [aria-selected=true]::after { content: ""; position: absolute; inset: auto 0 -1px; height: 2px; background: var(--text); }
.count { margin-left: .12rem; font-size: .76rem; font-variant-numeric: tabular-nums; }
.source-button, .subtle-button, .primary { border-radius: 7px; font-size: .9rem; font-weight: 580; line-height: 1.2; padding: .65rem .9rem; }
.source-button { margin-left: auto; display: inline-flex; align-items: center; gap: .55rem; border: 1px solid #3a3a40; background: #121214; }
.source-button:hover, .subtle-button:hover { background: #27272b; }
.source-button #source-chip::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); vertical-align: .13em; margin-right: .45rem; }
.source-button #source-chip.external::before { background: var(--green); }
.demo-label { margin-left: auto; align-self: center; font-size: .86rem; color: #c9c9ce; white-space: nowrap; }
.demo-label::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); vertical-align: .14em; margin-right: .45rem; }
#language-switch { align-self: center; color: var(--muted); font-size: .875rem; padding-block: .4rem; text-underline-offset: .22em; }
#language-switch:hover, #language-switch:focus-visible { color: var(--text); }
.mast-inner:has(#language-switch) { column-gap: clamp(1rem, 3vw, 2.5rem); }
.chevron { width: 7px; height: 7px; display: inline-block; flex: none; border: solid #adadb6; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
.subtle-button { border: 1px solid #3a3a40; background: #151517; }
.primary { background: #3266ee; color: #fff; }
.primary:hover { background: #487aff; }
.text-button, .book-bottom a { font-size: .875rem; font-weight: 540; color: var(--blue); padding: .25rem 0; text-decoration: none; }
.text-button:hover, .book-bottom a:hover { text-decoration: underline; }
.market-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 2.35rem 0 1.6rem; }
.venue { color: var(--muted); font-size: .9375rem; margin-bottom: .18rem; }
h1 { font-size: clamp(2rem, 3.3vw, 2.65rem); line-height: 1.14; letter-spacing: -.05em; font-weight: 650; }
h1 span { color: #686870; font-weight: 380; }
.quotes { display: grid; grid-template-columns: 1fr 1fr 1fr; border-block: 1px solid var(--line); padding: 1.15rem 0; }
.quote { min-width: 0; padding-right: 1rem; }
.quote + .quote { border-left: 1px solid var(--line); padding-left: 1.7rem; }
.quote h2, .chart-title h2 { font-size: .875rem; color: var(--muted); font-weight: 500; }
.price { font-size: clamp(1.7rem, 2.65vw, 2.1rem); font-variant-numeric: tabular-nums; line-height: 1.15; font-weight: 600; letter-spacing: -.045em; margin: .26rem 0 .32rem; overflow-wrap: anywhere; }
.price small { color: var(--muted); font-size: .57em; font-weight: 450; }
.muted, .return-line { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.return-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .48rem; }
.return-line strong { font-weight: 620; color: var(--text); font-variant-numeric: tabular-nums; }
.up, .return-line strong.up { color: var(--green); }
.down, .return-line strong.down { color: var(--red); }
.availability, .notice, .hold { color: var(--amber); }
.availability, .notice { font-size: .9rem; margin-top: .75rem; }
.notice:empty { display: none; }
.details { font-size: .875rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.details summary { display: flex; gap: 1rem; justify-content: space-between; align-items: center; padding-block: .65rem; cursor: pointer; list-style: none; }
.details summary::-webkit-details-marker { display: none; }
.details summary > span { display: inline-flex; align-items: center; gap: .6rem; color: #c8c8ce; }
.details summary:hover > span { color: #fff; }
.details summary small { font-size: .84rem; }
.details[open] summary .chevron { transform: translateY(1px) rotate(225deg); }
.detail-body { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: center; padding: .7rem 0 1.25rem; }
.breakdown > div, .chart-title, .chart-foot { display: flex; justify-content: space-between; gap: 1rem; }
.breakdown > div { margin-bottom: .4rem; }
.breakdown dd { color: var(--text); font-variant-numeric: tabular-nums; }
.detail-body p { margin-top: .5rem; }
.chart-wrap { position: relative; width: 100%; height: 91px; margin-top: .4rem; }
.chart-wrap canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.chart-title, .chart-foot { font-size: .78rem; }
.chart-foot { font-variant-numeric: tabular-nums; }

.market-book { margin-top: 1.65rem; }
.toolbar { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.45rem; }
.side-switch { display: inline-flex; align-items: center; background: #171719; border-radius: 8px; padding: 3px; gap: 2px; }
.side-switch button { border-radius: 6px; padding: .56rem 1.05rem; line-height: 1.2; font-size: .94rem; color: var(--muted); font-weight: 600; }
.side-switch button:hover { color: var(--text); }
.side-switch [aria-pressed=true] { background: #333338; color: white; }
#settings, .demo-filters { display: flex; align-items: end; gap: .7rem; flex-wrap: wrap; }
.demo-filters #amount { width: 8rem; }
.field, #fee-form label { display: grid; gap: .28rem; color: var(--muted); font-size: .82rem; font-weight: 500; }
.field-value, .select-wrap { display: flex; align-items: center; position: relative; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); height: 38px; }
.field-value:focus-within, .select-wrap:focus-within { outline: 2px solid var(--blue); outline-offset: 1px; }
.field input, .field select { background: transparent; border: 0; outline: 0; color: var(--text); font-size: .9rem; }
.field input { width: 6.1rem; padding: .45rem .65rem; }
.field-value > span { padding-right: .7rem; color: #c2c2c9; font-size: .85rem; }
.field select { width: 10.5rem; height: 100%; appearance: none; padding: .4rem 1.9rem .4rem .65rem; }
select option { background: var(--surface); color: var(--text); }
.select-wrap .chevron { position: absolute; right: .75rem; pointer-events: none; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .94rem; }
th { color: var(--muted); font-size: .82rem; font-weight: 500; white-space: nowrap; }
th, td { border-bottom: 1px solid var(--line); padding: .98rem .65rem; }
th { padding-top: 0; padding-bottom: .7rem; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { text-align: right; padding-right: 0; }
td { overflow-wrap: anywhere; }
.merchant-inner { display: flex; align-items: center; gap: .65rem; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; flex: none; border-radius: 50%; color: #dad6e2; background: #302d37; font-size: .9rem; font-weight: 620; }
.avatar.t1 { background: #273431; color: #c9e4d8; }
.avatar.t2 { background: #352e29; color: #ead9c6; }
.avatar.t3 { background: #2b303a; color: #d1dbf1; }
.merchant-text strong, .quantity span { display: block; }
.merchant-text strong { font-weight: 620; }
td small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.price-cell { font-weight: 630; font-size: 1.14rem; white-space: nowrap; }
.price-cell span { color: var(--muted); font-size: .81rem; margin-left: .24rem; font-weight: 500; }
.price-cell, .quantity { font-variant-numeric: tabular-nums; }
.payment { display: inline-block; border-left: 2px solid #7c9bf2; padding-left: .48rem; font-size: .88rem; }
.status { color: var(--muted); font-size: .84rem; }
.status.matched { color: var(--green); font-weight: 580; }
.status.matched::before { content: "✓"; display: inline-block; margin-right: .32rem; }
.book-bottom, footer { display: flex; align-items: center; justify-content: space-between; gap: .75rem; color: var(--muted); font-size: .82rem; }
.book-bottom { padding: .65rem 0; }
footer { border-top: 1px solid var(--line); margin-top: 1.8rem; padding: 1rem 0 2.5rem; flex-wrap: wrap; }
.event-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.event-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: baseline; padding: .95rem 0; border-bottom: 1px solid var(--line); }
.event-list time, .event-list small, .empty { color: var(--muted); font-size: .875rem; }
.event-list small { display: block; overflow-wrap: anywhere; }
.event-list strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.empty { padding: 1.6rem .1rem; }
dialog { width: min(420px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); color: var(--text); background: #171719; border: 1px solid #38383c; border-radius: 12px; padding: 1.35rem; }
dialog::backdrop { background: rgb(0 0 0 / .7); }
.dialog-head, .actions { display: flex; align-items: center; gap: .6rem; }
.dialog-head { justify-content: space-between; margin-bottom: .9rem; }
.dialog-head h2 { font-size: 1.3rem; font-weight: 650; letter-spacing: -.03em; }
dialog h3 { font-size: 1rem; }
dialog p { margin: .35rem 0 .85rem; color: var(--muted); font-size: .9rem; }
dialog hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.close { font-size: 1.45rem; line-height: 1; padding: .3rem; color: var(--muted); }
.actions + .text-button { margin-top: .65rem; }
#fee-form { display: grid; gap: .75rem; }
#fee-form input, #fee-form select { width: 100%; min-width: 0; border: 1px solid #414146; background: var(--bg); border-radius: 6px; padding: .55rem .65rem; }
#fee-form p { margin: 0; }
.fee-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 780px) {
  .wrap { width: calc(100% - 2.5rem); }
  .mast-inner { gap: 2rem; }
  .quote + .quote { padding-left: 1rem; }
  .quote { padding-right: .65rem; }
  .avatar { display: none; }
  th, td { padding-inline: .4rem; }
}
@media (max-width: 600px) {
  .wrap { width: calc(100% - 2rem); }
  .mast-inner { display: grid; grid-template-columns: 1fr auto; gap: 0 1rem; }
  .brand, .source-button { margin-block: .7rem; }
  .mast nav { grid-area: 2 / 1 / 3 / 2; gap: 1rem; min-height: 40px; white-space: nowrap; }
  .mast-inner:has(#language-switch) { column-gap: .55rem; }
  #language-switch { grid-area: 2 / 2; justify-self: end; }
  .source-button, .demo-label { grid-area: 1 / 2; }
  .market-heading { padding: 1.45rem 0 1.1rem; }
  .quotes { grid-template-columns: 1fr 1fr; padding: .9rem 0 0; }
  .quote:nth-child(2) { padding-left: 1rem; }
  .quote.return { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; align-items: baseline; border: 0; border-top: 1px solid var(--line); padding: .7rem 0; margin-top: .85rem; }
  .return .price { grid-area: 1 / 2; margin: 0; font-size: 1.38rem; text-align: right; }
  .return-line { grid-column: 1 / -1; }
  .detail-body { grid-template-columns: 1fr; gap: 1.1rem; }
  .market-book { margin-top: 1.15rem; }
  .toolbar { display: grid; justify-content: stretch; gap: .7rem; margin-bottom: .9rem; }
  .side-switch { justify-self: start; }
  #settings, .demo-filters { display: grid; grid-template-columns: minmax(0,.88fr) minmax(0,1.12fr); }
  .field input, .field select, .demo-filters #amount { width: 100%; }
  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: center; gap: .4rem .6rem; padding-block: .9rem; border-top: 1px solid var(--line); }
  tbody tr:last-child { border-bottom: 1px solid var(--line); }
  td { padding: 0; border: 0; }
  .avatar { display: grid; width: 29px; height: 29px; }
  .price-cell { text-align: right; }
  .quantity { grid-column: 1; grid-row: 2 / 4; font-size: .85rem; }
  .payment-cell { text-align: right; }
  .payment { font-size: .78rem; }
  .status { font-size: .77rem; }
  .book-bottom { padding-block: .5rem; }
  footer { margin-top: 1rem; }
  .event-list li { grid-template-columns: 1fr auto; gap: .35rem .5rem; }
  .event-list li > div { grid-column: 1 / -1; grid-row: 2; }
}
