/* The pages that do things (the market, the character select), on top of /style.css: the bar with the
   wallet button, buttons, fields, sheets (dialogs), the transaction steps and the toast.
   Same rules as the landing page: pixel art at whole-number scales, Jersey 10 at whole font pixels
   (multiples of --j), Tiny5 at 16 px or 24 px only. */

.app-page {
  /* style.css's --stone again, from the site root: a relative url() in a custom property resolves
     against the sheet that uses it, and from a page below the root that path does not exist */
  --stone: url("/img/night/frame9.png") 6 / 12px / 0 stretch;
}
.app-page .portal { min-height: calc(100vh - 2 * var(--m)); }
.app-page .foot { padding-bottom: 64px; }
.disclaimer { max-width: 60ch; margin: 0 auto; }

/* ---------- the bar ---------- */
.bar {
  position: relative;
  z-index: 31;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding: calc(var(--ft) + 16px) var(--pad) 0;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--bone); text-decoration: none; font: 400 calc(2 * var(--j)) / 1 var(--display); }
.brand img { width: 34px; height: 39px; }
.nav { display: flex; gap: 20px; margin-right: auto; }
.nav a { color: var(--muted); text-decoration: none; font-size: 24px; line-height: 1; }
.nav a:hover { color: var(--g3); }
.nav a[aria-current="page"] { color: var(--g2); box-shadow: 0 4px 0 0 var(--g1); }
@media (max-width: 559px) {
  /* the skull alone: the name and the wallet button do not fit one row */
  .brand span { display: none; }
  .nav { order: 3; width: 100%; }
}

/* ---------- buttons ---------- */
.btn {
  --b: 4px;
  display: inline-block;
  padding: 2px 28px 6px;
  border: 0;
  cursor: pointer;
  background: var(--g2);
  color: var(--deep);
  font: 400 calc(2 * var(--j)) / 1 var(--display);
  box-shadow:
    0 calc(-1 * var(--b)) 0 0 var(--deep),
    0 var(--b) 0 0 var(--deep),
    calc(-1 * var(--b)) 0 0 0 var(--deep),
    var(--b) 0 0 0 var(--deep),
    inset 0 var(--b) 0 0 var(--g3),
    inset 0 calc(-1 * var(--b)) 0 0 var(--g1);
}
.btn:hover { background: var(--g3); }
.btn:disabled { cursor: default; background: var(--s3); color: var(--muted); box-shadow: 0 calc(-1 * var(--b)) 0 0 var(--deep), 0 var(--b) 0 0 var(--deep), calc(-1 * var(--b)) 0 0 0 var(--deep), var(--b) 0 0 0 var(--deep); }
.btn-2 {
  --b: 4px;
  display: inline-block;
  padding: 8px 14px;
  border: 0;
  cursor: pointer;
  background: var(--deep);
  color: var(--bone);
  font: 400 16px / 1.25 var(--body);
  box-shadow: 0 calc(-1 * var(--b)) 0 0 var(--s3), 0 var(--b) 0 0 var(--s3), calc(-1 * var(--b)) 0 0 0 var(--s3), var(--b) 0 0 0 var(--s3);
}
.btn-2:hover { color: var(--g3); box-shadow: 0 calc(-1 * var(--b)) 0 0 var(--g1), 0 var(--b) 0 0 var(--g1), calc(-1 * var(--b)) 0 0 0 var(--g1), var(--b) 0 0 0 var(--g1); }
.btn-2.danger { color: #f0a8b8; }
a.btn-2, a.btn { text-decoration: none; }
.wallet { margin-left: auto; }
.linkish { padding: 0; border: 0; background: none; color: var(--g2); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }

/* ---------- fields ---------- */
.field { display: grid; gap: 6px; text-align: left; }
.field > span { color: var(--muted); }
.field select, .field input {
  min-width: 0;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: var(--deep);
  color: var(--bone);
  font: 400 16px / 1.25 var(--body);
  box-shadow: inset 0 0 0 2px var(--s3);
}
.field select:focus-visible, .field input:focus-visible { outline: 4px solid var(--g2); outline-offset: 2px; }

/* ---------- sheets ---------- */
.sheet {
  width: min(820px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  margin: auto;
  padding: 20px;
  border: 12px solid transparent;
  border-image: var(--stone);
  background: var(--panel) padding-box;
  color: var(--bone);
  overflow: auto;
}
.sheet.small { width: min(460px, calc(100vw - 24px)); }
.sheet::backdrop { background: rgba(7, 0, 13, 0.82); }
.sheet .close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: var(--deep) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Cpath fill='%23d9caef' d='M0 0h1v1H0zM1 1h1v1H1zM2 2h1v1H2zM3 3h1v1H3zM4 4h1v1H4zM5 5h1v1H5zM6 6h1v1H6zM6 0h1v1H6zM5 1h1v1H5zM4 2h1v1H4zM2 4h1v1H2zM1 5h1v1H1zM0 6h1v1H0z'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
  box-shadow: inset 0 0 0 2px var(--s3);
}
.sheet .close:hover { box-shadow: inset 0 0 0 2px var(--g2); }
.sh-name { margin: 0; padding-right: 40px; font: 400 calc(3 * var(--j)) / 1 var(--display); color: var(--bone); }
.sheet.small .sh-name { font-size: calc(2 * var(--j)); }
@media (max-width: 399px) { .sh-name { font-size: calc(2 * var(--j)); } }
.loading, .error { margin: 0; }
.error { color: #f0a8b8; }

.pick-list { display: grid; gap: 14px; margin: 18px 4px 4px; padding: 0; list-style: none; }
.wallet-choice { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; }
.wallet-choice img { width: 24px; height: 24px; image-rendering: auto; }
.addr { margin: 12px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.row { display: flex; flex-wrap: wrap; gap: 16px; margin: 18px 4px 4px; }

/* ---------- transaction steps ---------- */
.steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; display: flex; gap: 10px; align-items: baseline; color: var(--muted); }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; background: var(--deep); box-shadow: inset 0 0 0 2px var(--s3); color: var(--muted); }
.steps li.doing { color: var(--bone); }
.steps li.doing::before { box-shadow: inset 0 0 0 2px var(--g2); color: var(--g2); animation: pulse 1.2s steps(2) infinite; }
.steps li.done { color: var(--g2); }
.steps li.done::before { content: ""; background: var(--g2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 6' shape-rendering='crispEdges'%3E%3Cpath fill='%230c0418' d='M6 0h1v1H6zM5 1h1v1H5zM4 2h1v1H4zM0 3h1v1H0zM3 3h1v1H3zM1 4h1v1H1zM2 4h1v1H2zM2 5h1v1H2z'/%3E%3C/svg%3E") center / 14px 12px no-repeat; box-shadow: none; }
.steps li.failed { color: #f0a8b8; }
.steps li.failed::before { box-shadow: inset 0 0 0 2px #f0a8b8; color: #f0a8b8; }

/* a popover, so it sits in the top layer above an open sheet */
.toast {
  position: fixed;
  inset: auto auto 24px 50%;
  margin: 0;
  border: 0;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  transform: translateX(-50%);
  background: var(--deep);
  color: var(--bone);
  box-shadow: 0 -4px 0 0 var(--g1), 0 4px 0 0 var(--g1), -4px 0 0 0 var(--g1), 4px 0 0 0 var(--g1);
}

@media (prefers-reduced-motion: reduce) {
  .steps li.doing::before { animation: none; }
}
