/* The Bork trading desk: blue graph paper, a toy chart rolling up and down across the top band
   with the crowned husky surfing its tip, and the form on an opaque paper ticket below it.
   The chart only ever moves inside the band; readable text always sits on a solid surface. */
html[data-registration-open] {
  overflow: hidden;
  scrollbar-gutter: auto;
}
html[data-registration-open] .grid,
html[data-registration-open] .backdrop {
  animation-play-state: paused !important;
}
dialog.registration[data-open='true'] {
  --edge: 16px;
  --band: 168px;
  --rider: 76px;
  --head: 56px;
  --bx-ink: #20222a;
  --bx-ink-2: #5b5f6c;
  --bx-line: rgba(32, 34, 42, 0.15);
  --bx-inset: #f2eee4;
  --reg-card: #fffdf8;
  position: fixed;
  inset: 0;
  margin: auto;
  left: 0;
  top: 0;
  /* Fixed outer bounds for every screen and loading state: the box never snaps. */
  width: min(640px, calc(100vw - 2 * var(--edge)));
  width: min(
    640px,
    calc(100vw - 2 * var(--edge) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px))
  );
  height: min(700px, calc(100vh - 2 * var(--edge)));
  height: min(
    700px,
    calc(
      100dvh - 2 * var(--edge) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
    )
  );
  max-height: none;
  max-width: none;
  padding: 0;
  transform: none;
  opacity: 1;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
  font-family: 'Cairo', 'Avenir Next', system-ui, sans-serif;
  line-height: 1.55;
  color: var(--bx-ink);
  background-color: #f5f2ea;
  background-image:
    linear-gradient(rgba(61, 99, 230, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61, 99, 230, 0.075) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  border: 1px solid rgba(32, 34, 42, 0.24);
  border-radius: 16px;
  box-shadow:
    0 26px 58px rgba(20, 22, 30, 0.22),
    0 4px 12px rgba(20, 22, 30, 0.08);
  overflow: hidden;
  isolation: isolate;
  box-sizing: border-box;
}
dialog.registration:not([open]) {
  display: none;
}
dialog.registration[open] {
  display: flex;
  flex-direction: column;
  animation: registration-enter 260ms var(--bx-ease-spring) both;
}
.registration::backdrop {
  background: var(--bx-scrim, rgba(22, 26, 38, 0.42));
  backdrop-filter: blur(5px);
}
.registration *,
.registration *::before,
.registration *::after {
  box-sizing: border-box;
}
.registration [hidden] {
  display: none !important;
}

/* ---- the chart layer: decoration only, never a pointer target ---- */
.registration-chart {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.registration-chart canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.registration-rider {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--rider);
  height: var(--rider);
  max-width: none;
  object-fit: contain;
  transform-origin: 50% 94%;
  filter: drop-shadow(0 5px 4px rgba(48, 42, 28, 0.24));
  visibility: hidden;
  will-change: transform;
}
.registration-chart[data-ready] .registration-rider {
  visibility: visible;
}
.registration .bk-modal__head,
.registration-gallery,
.registration-body {
  position: relative;
  z-index: 1;
}

/* ---- head: a nameplate on the desk, pause and close on the right ---- */
.registration .bk-modal__head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--head);
  flex: 0 0 var(--head);
  padding: 6px 12px 0 20px;
}
.registration-brand {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 10px 4px;
  border: 1.5px solid rgba(32, 34, 42, 0.2);
  border-radius: 8px;
  background: var(--reg-card);
  box-shadow: 0 2px 0 rgba(32, 34, 42, 0.08);
  font-family: var(--font-slab, 'Roboto Slab', Georgia, serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--bx-ink);
}
.registration-tools {
  display: flex;
  gap: 6px;
  margin-inline-start: auto;
  flex: 0 0 auto;
}
.registration .bk-modal__close,
.registration-motion {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  cursor: pointer;
  border: 2px solid var(--bx-line);
  border-radius: 10px;
  background: var(--bx-inset);
  color: var(--bx-ink-2);
  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease;
}
.registration .bk-modal__close::before {
  display: none;
}
.registration-motion svg {
  width: 18px;
  height: 18px;
}
.registration-motion[aria-pressed='true'] .registration-motion-pause,
.registration-motion[aria-pressed='false'] .registration-motion-play {
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  .registration .bk-modal__close:hover,
  .registration-motion:hover {
    background: #e9e3d6;
    border-color: rgba(32, 34, 42, 0.24);
    color: var(--bx-ink);
  }
}

/* ---- the band the chart rolls through; it only reserves space ---- */
.registration-gallery {
  flex: 0 0 var(--band);
  min-height: 0;
}
.registration-demo {
  position: absolute;
  left: 20px;
  top: 4px;
  max-width: calc(100% - 40px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 1px 8px 2px;
  border-radius: 6px;
  background: var(--reg-card);
  border: 1px solid var(--bx-line);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--bx-ink-2);
}

/* ---- the single scroll owner ---- */
.registration-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 20px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.registration-body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* ---- the ticket ---- */
.registration-flow {
  position: relative;
  min-height: 334px;
  padding: 22px 24px 20px;
  border: 1.5px solid rgba(32, 34, 42, 0.2);
  border-radius: 14px;
  background: var(--reg-card);
  box-shadow:
    0 2px 0 rgba(32, 34, 42, 0.06),
    0 16px 30px -14px rgba(48, 42, 28, 0.32),
    inset 0 1px 0 white;
}
.registration section {
  text-align: left;
}
.registration h1 {
  font-family: var(--font-slab, 'Roboto Slab', Georgia, serif);
  font-size: clamp(24px, 5vw, 30px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
  text-wrap: balance;
  margin: 0 0 8px;
  outline: none;
  color: var(--bx-ink);
}
.registration h1:focus-visible {
  outline: none;
}
.registration p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--bx-ink-2);
  margin: 0 0 12px;
  overflow-wrap: break-word;
}
.registration .registration-intro {
  font-weight: 700;
  color: var(--bx-ink);
  font-size: 17px;
  margin-bottom: 6px;
}
.registration-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--bx-accent-soft);
  color: var(--bx-accent-text);
  font-size: 28px;
}
.registration-icon svg {
  width: 30px;
  height: 30px;
}
.registration-label {
  font-size: 13px;
  font-weight: 700;
  margin: 14px 0 8px;
  color: var(--bx-ink);
}
.registration-wallets {
  display: grid;
  gap: 10px;
}
.registration .registration-wallet {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 52px;
  gap: 12px;
  justify-content: start;
  padding: 10px 14px;
  text-decoration: none;
  cursor: pointer;
}
.registration-wallet-mark,
.registration-account-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  color: var(--bx-accent-text);
}
.registration-wallet-mark svg,
.registration-account-icon svg {
  width: 26px;
  height: 26px;
}
.registration-wallet-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-weight: 700;
}
.registration-wallet-action {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--bx-ink-2);
  font-size: 12px;
}
.registration .registration-wide {
  display: flex;
  width: 100%;
  height: auto;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  margin-top: 10px;
}
.registration .registration-wide:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.registration .registration-note {
  font-size: 12px;
  margin: 14px 0 0;
  line-height: 1.6;
}
.registration-link {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  color: var(--bx-accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  padding: 6px;
}
.registration-remove {
  display: block;
  margin: 10px auto 0;
  color: var(--bx-ink-2);
}
.registration-account {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: var(--bx-r-input);
  background: var(--bx-inset);
  border: 1px solid var(--bx-line);
  margin: 18px 0;
}
.registration-account > div {
  display: grid;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}
.registration-account [data-provider] {
  font-size: 12px;
  color: var(--bx-ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.registration-account code {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
}
.registration-account .registration-link {
  flex: 0 0 auto;
  margin-left: auto;
}
.registration-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--bx-ink-2);
  min-height: 44px;
  cursor: pointer;
  margin-bottom: 16px;
}
.registration-consent input {
  margin: 3px 0 0;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--bx-accent);
}
.registration .registration-status {
  color: var(--bx-down);
  font-size: 13px;
  margin: 16px 0 0;
  overflow-wrap: anywhere;
}
.registration .registration-status:empty {
  display: none;
}
.registration-privacy {
  margin-top: 10px;
  padding: 0 14px;
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--bx-line);
  color: var(--bx-ink-2);
}
.registration-privacy summary {
  min-height: 44px;
  display: list-item;
  align-content: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 10px 0;
}
.registration-privacy p {
  font-size: 12px;
}
.registration a:not(.bk-btn) {
  color: var(--bx-accent-text);
  text-underline-offset: 3px;
}
.registration :is(button, a, input, summary):focus-visible {
  outline: var(--bx-stroke-focus) solid var(--bx-focus);
  outline-offset: 3px;
}
.registration-stamp {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bx-accent-soft);
  margin: 0 auto 12px;
}
.registration-stamp img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.registration-stamp span {
  position: absolute;
  right: -3px;
  bottom: 5px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bx-up);
  color: white;
  border: 3px solid white;
  font-weight: 800;
}
.registration[data-screen='success'] .registration-stamp {
  animation: registration-stamp 360ms var(--bx-ease-spring) both;
}
.registration [data-screen='success'],
.registration [data-screen='removed'] {
  text-align: center;
}
.registration [data-screen='removed'] .registration-icon {
  margin: 8px auto 20px;
}
.registration-next {
  background: var(--bx-inset);
  padding: 14px 16px;
  border-radius: var(--bx-r-card);
  text-align: left;
  margin: 16px 0;
}
.registration-next b {
  font-size: 13px;
}
.registration-next p {
  font-size: 13px;
  margin: 5px 0 0;
}
.registration-wait {
  margin-top: 4px;
  margin-bottom: 14px;
}
.registration-wallet-options {
  min-height: 120px;
  position: relative;
}
.registration-wallet-loading {
  display: grid;
  gap: 10px;
}
.registration-wallet-loading span {
  display: block;
  height: 52px;
  border: 1px solid var(--bx-line);
  border-radius: 10px;
  background: linear-gradient(90deg, #efede6 12%, #f7f5ee 45%, #efede6 78%);
}
.registration .registration-browser-note {
  font-size: 12px;
  margin-bottom: 8px;
}
.registration-no-wallet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 10px;
}
.registration-no-wallet .registration-browser-note,
.registration-no-wallet [data-refresh] {
  grid-column: 1 / -1;
}
.registration-no-wallet .registration-wide {
  min-width: 0;
  white-space: normal;
  padding: 8px;
  line-height: 1.3;
  text-align: center;
  margin-top: 0;
  font-size: 14px;
}
.registration-no-wallet [data-refresh] {
  justify-self: center;
}
@keyframes registration-enter {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes registration-stamp {
  from {
    opacity: 0;
    transform: scale(0.9) rotate(-7deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

/* ---- phones ---- */
@media (max-width: 540px) {
  dialog.registration[data-open='true'] {
    --edge: 12px;
    --band: 136px;
    --rider: 62px;
    border-radius: 14px;
  }
  .registration .bk-modal__head {
    padding-left: 14px;
    padding-right: 8px;
  }
  .registration-demo {
    left: 14px;
  }
  .registration-body {
    padding: 0 10px 12px;
  }
  .registration-flow {
    padding: 18px 16px;
  }
  .registration h1 {
    font-size: 24px;
  }
  .registration p {
    font-size: 13px;
  }
  .registration .registration-intro {
    font-size: 15px;
  }
  .registration-no-wallet {
    gap: 0 6px;
  }
  .registration-no-wallet .registration-wide {
    font-size: 12px;
  }
}

/* ---- short screens: the band shrinks before any control does ---- */
@media (max-height: 720px) {
  dialog.registration[data-open='true'] {
    --band: 112px;
    --rider: 52px;
    --head: 50px;
  }
}
@media (max-height: 620px) {
  dialog.registration[data-open='true'] {
    --band: 78px;
    --rider: 42px;
    --head: 48px;
  }
  .registration-flow {
    min-height: 0;
    padding-top: 16px;
    padding-bottom: 16px;
  }
  .registration h1 {
    font-size: 22px;
  }
  .registration-label {
    margin: 10px 0 6px;
  }
  .registration .registration-note {
    margin-top: 10px;
  }
  .registration-privacy {
    margin-top: 8px;
  }
}

/* ---- landscape phones and zoomed desktops: the band becomes a side column ---- */
@media (max-height: 500px) and (min-width: 560px) {
  dialog.registration[data-open='true'] {
    --edge: 10px;
    --rider: 60px;
    --head: 48px;
    width: min(780px, calc(100vw - 2 * var(--edge)));
    width: min(
      780px,
      calc(
        100vw - 2 * var(--edge) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)
      )
    );
  }
  dialog.registration[open] {
    display: grid;
    grid-template-columns: minmax(170px, 34%) minmax(0, 1fr);
    grid-template-rows: var(--head) minmax(0, 1fr);
  }
  .registration .bk-modal__head {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  .registration-gallery {
    grid-column: 1;
    grid-row: 2;
  }
  .registration-body {
    grid-column: 2;
    grid-row: 2;
    padding: 0 12px 12px 0;
  }
  .registration-flow {
    min-height: 0;
    padding: 16px 18px;
  }
  .registration h1 {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog.registration[open],
  .registration[data-screen='success'] .registration-stamp {
    animation: none;
  }
}
