@import url("./tokens.css");

* {
  box-sizing: border-box;
}
:root {
  --ink: var(--qb-bg);
  --panel: var(--qb-panel);
  --edge: var(--qb-edge);
  --paper: var(--qb-paper);
  --mist: var(--qb-mist);
  --mute: var(--qb-muted);
  --accent: var(--qb-focus-dark);
  --teal: var(--qb-teal);
  --mint: var(--qb-mint);
  --wide: "Bahnschrift", "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
  background: var(--ink);
  color: var(--paper);
  font:
    15px/1.48 "Segoe UI",
    Arial,
    sans-serif;
}
body {
  /* Chrome sizes the toolbar popup from the document's preferred width. */
  width: 420px;
  max-width: 100%;
  margin: 0;
}
body.wallet-tab,
body.site-approval {
  width: auto;
}
main,
#dock {
  max-width: 500px;
  margin: auto;
}
main {
  padding: 0 20px 22px;
  min-height: 490px;
}
body:has(#dock:not([hidden])) main {
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
}
h1,
h2,
p,
ol {
  margin: 0;
}
h1 {
  font-size: 1.08rem;
  letter-spacing: -0.04em;
}
h2 {
  font-size: clamp(2rem, 9vw, 3.2rem);
  letter-spacing: -0.065em;
  line-height: 1.02;
  font-weight: 510;
  margin: 0.35em 0 0.5em;
  text-wrap: balance;
}
p,
output {
  overflow-wrap: anywhere;
}
small,
.build-label {
  font-size: 0.72rem;
  font-weight: 620;
  letter-spacing: 0.025em;
}
.build-label {
  color: var(--mute);
  margin-top: 18px;
}
main {
  position: relative;
  isolation: isolate;
}
/* the two soft discs from the design preview, drifting slowly */
main::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: 190px;
  background:
    radial-gradient(circle at 92% -4%, var(--teal) 0 17%, transparent 30%),
    radial-gradient(circle at 86% -6%, var(--accent) 0 32%, transparent 56%);
  mask-image: linear-gradient(#000 55%, transparent);
}
.identity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0 10px;
}
.identity small {
  margin-left: auto;
  background: var(--mist);
  color: var(--teal);
  padding: 4px 10px;
}
.identity span {
  display: block;
  font:
    11px/1.4 Consolas,
    monospace;
}
.crest,
.vault-object i {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
}
.crest {
  width: 34px;
  height: 34px;
  font: 700 16px/1 var(--wide);
}
h2 {
  font-family: var(--wide);
  font-weight: 300;
}
#accounts-open {
  margin-bottom: 10px;
}
.account-dialog {
  max-height: 85vh;
  overflow: auto;
}
#accounts-list {
  list-style: none;
  padding: 0;
  margin-block: 14px;
}
#accounts-list button,
#secrets-form button {
  width: 100%;
  margin-block: 4px;
}
.account-dialog summary {
  min-height: 44px;
  align-content: center;
}
#secret-value {
  overflow-wrap: anywhere;
  user-select: text;
}
#status {
  margin: 4px 0 10px;
  font-size: 0.74rem;
  color: var(--mist);
}
#access,
.lock-cover,
.portfolio {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--mist);
  color: var(--ink);
  margin-inline: -20px;
  padding: 24px 20px;
}
#access::before,
.lock-cover::before,
.portfolio::before,
#access::after,
.lock-cover::after,
.portfolio::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(22px);
}
#access::before,
.lock-cover::before,
.portfolio::before {
  width: 360px;
  height: 360px;
  right: -150px;
  top: -110px;
  background: var(--accent);
}
#access::after,
.lock-cover::after,
.portfolio::after {
  width: 220px;
  height: 220px;
  right: -90px;
  top: -100px;
  background: var(--teal);
}
.lock-cover {
  min-height: 270px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.lock-cover h2,
#access h2 {
  font-size: 2.9rem;
}
.lock-cover p,
#access p {
  max-width: 29ch;
}
.vault-object {
  height: 110px;
  display: grid;
  place-items: center;
}
.vault-object i {
  width: 62px;
  height: 62px;
}
.vault-object i::after {
  content: "Q";
  font: normal 700 28px var(--wide);
}
body:has(#welcome-actions[hidden]) .vault-object {
  display: none;
}
#welcome-actions,
.tiles {
  display: flex;
  gap: 2px;
  margin-top: 20px;
}
#welcome-actions button,
.tiles button {
  flex: 1;
  margin: 0;
}
#welcome-actions button:first-child {
  background: var(--ink);
  color: var(--paper);
}
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  transition: transform 0.35s var(--ease);
}
button,
input,
textarea {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
button {
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  min-height: 46px;
  padding: 0.66rem 1rem;
  font-weight: 620;
  margin: 0.25rem 0.15rem 0.25rem 0;
  transition:
    background 0.2s,
    scale 0.2s var(--ease);
}
/* touch dot: expands from the middle of whatever was pressed */
button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: currentColor;
  translate: -50% -50%;
  scale: 0;
  opacity: 0;
  pointer-events: none;
  transition:
    scale 0.45s var(--ease),
    opacity 0.45s;
}
button:active:enabled::after {
  scale: 1.2;
  opacity: 0.35;
  transition: none;
}
button:disabled {
  opacity: 0.48;
  cursor: default;
}
button:hover:enabled {
  filter: brightness(0.94);
}
button:hover:enabled svg {
  transform: translateY(-2px);
}
button:active:enabled {
  scale: 0.97;
}
a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  color: var(--mint);
  font-weight: 620;
  text-underline-offset: 0.25em;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
#vault-form,
#agent-form,
#kernel-form {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}
label {
  display: block;
  color: var(--mute);
  font-weight: 600;
  font-size: 0.82rem;
  margin: 0.45rem 0;
}
input,
textarea {
  appearance: none;
  color: var(--paper);
  background: var(--panel);
  border: 0;
  border-bottom: 2px solid #6f7a76;
  border-radius: 2px;
  width: 100%;
  display: block;
  padding: 12px 14px;
  margin: 5px 0;
  min-height: 46px;
}
input:focus,
textarea:focus {
  border-color: var(--accent);
  background: #2f3331;
}
textarea {
  min-height: 88px;
  resize: vertical;
}
.hint {
  color: var(--mute);
  font-size: 0.8rem;
}
#unlock,
#create,
#import,
#continue-sign,
#confirm,
#kernel-confirm,
#send button[type="submit"],
#to-amount {
  background: var(--accent);
}
.back,
#access-back,
#cancel {
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--edge);
}
.home main::before {
  display: none;
}
.home .identity {
  position: absolute;
  inset: 0 20px auto;
  z-index: 1;
  color: var(--ink);
}
.home #status {
  position: absolute;
  z-index: 1;
  top: 64px;
  color: var(--teal);
}
.home #accounts-open {
  position: absolute;
  z-index: 2;
  top: 64px;
  right: 20px;
  min-height: 44px;
  transform: translateY(-4px);
  margin: 0;
  padding: 4px 9px;
  color: #fff;
  border-color: #fff;
  background: var(--teal);
  font-size: 0.78rem;
}
.portfolio {
  padding: 112px 12px 12px;
}
.portfolio > small,
.portfolio #balance {
  margin-inline: 8px;
}
.portfolio #balance {
  font-size: 3.7rem;
  letter-spacing: 0;
  font-weight: 300;
  overflow-wrap: anywhere;
  margin-block: 0 4px;
}
#balance span {
  font-size: 0.42em;
}
#balance:not(:has(span)) {
  font-size: 1.7rem;
}
.tiles button {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 86px;
  font-size: 0.82rem;
  font-weight: 500;
}
.row {
  width: 100%;
  background: transparent;
  color: var(--paper);
  text-align: left;
  display: grid;
  border: 0;
  border-bottom: 1px solid var(--edge);
  padding: 20px 34px 20px 0;
  margin: 0;
}
.row::before {
  content: "→";
  position: absolute;
  right: 6px;
  top: calc(50% - 0.75em);
  transition: translate 0.35s var(--ease);
}
.row:hover::before {
  translate: 6px 0;
}
.row:last-child {
  border-bottom: 0;
}
.row strong {
  font: 300 1.65rem var(--wide);
}
.row span {
  color: var(--mute);
  font-size: 0.8rem;
}
#dock {
  position: fixed;
  inset: auto 0 0;
  z-index: 3;
  display: flex;
  background: var(--ink);
  border-top: 1px solid var(--edge);
  padding-bottom: env(safe-area-inset-bottom);
}
#dock button {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 60px;
  flex: 1;
  padding: 0;
  margin: 0;
  color: var(--paper);
  background: transparent;
}
#dock span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
#dock [aria-current="true"] {
  background: var(--paper);
  color: var(--ink);
}
[data-page]:not([data-page="Home"]) {
  padding: 10px 0;
}
#amount {
  font: 300 3.2rem var(--wide);
  color: var(--accent);
  background: transparent;
  border-bottom: 1px solid var(--paper);
  padding-inline: 0;
}
#keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-inline: -20px;
  padding: 4px 20px;
  background: radial-gradient(ellipse at 50% -20%, var(--teal), transparent 70%);
}
#keypad button {
  margin: 0;
  background: transparent;
  color: var(--paper);
  font: 300 1.5rem var(--wide);
  min-height: 42px;
  padding: 4px;
}
#keypad button:hover {
  background: #ffffff0d;
}
#amount-step > button:last-child {
  width: 100%;
  margin-top: 8px;
}
body[data-view="Send"] .identity {
  padding-block: 8px;
}
body[data-view="Send"] #status {
  margin: 0;
}
body[data-view="Send"] .back {
  min-height: 32px;
  padding: 4px 9px;
  font-size: 0.8rem;
}
body[data-view="Send"] h2 {
  font-size: 1.8rem;
  margin: 0.2rem 0;
}
output,
#recovery-phrase {
  display: block;
  background: var(--panel);
  padding: 18px;
  border-radius: 2px;
  font:
    0.95rem/1.65 Consolas,
    monospace;
  margin: 14px 0;
}
#address {
  border-left: 3px solid var(--mint);
}
#recovery-phrase {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  counter-reset: word;
  gap: 7px;
  padding: 10px;
}
#recovery-phrase li {
  counter-increment: word;
  background: var(--teal);
  border-radius: 2px;
  padding: 6px;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}
#recovery-phrase li:before {
  content: counter(word);
  display: block;
  font-size: 0.65rem;
  color: var(--mint);
}
details,
#activity,
#processing,
#empty-activity,
#pq,
#agent-help,
[data-page="Settings"] > p:not(.build-label) {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 2px;
  padding: 14px;
  margin: 12px 0;
}
summary {
  list-style: none;
  cursor: pointer;
  font-weight: 620;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 30px;
}
summary::-webkit-details-marker {
  display: none;
}
summary:after {
  content: "+";
  font-size: 1.3rem;
  color: var(--mint);
}
details[open] > summary:after {
  content: "−";
}
details[open] > summary {
  margin-bottom: 12px;
  border-bottom: 1px solid var(--edge);
  padding-bottom: 9px;
}
#review,
.account-dialog {
  color: var(--paper);
  width: min(100%, 500px);
  max-width: 500px;
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  margin-bottom: 0;
  background:
    radial-gradient(circle at 100% -12%, var(--accent), var(--teal) 22%, transparent 42%),
    var(--ink);
  border: 0;
  border-top: 1px solid var(--edge);
  padding: 28px 20px 20px;
}
#review button {
  width: 100%;
  margin-inline: 0;
}
#review::backdrop,
.account-dialog::backdrop {
  background: #0d1a18d9;
}
#preview {
  padding-block: 12px;
  margin-bottom: 14px;
  border-block: 1px solid var(--edge);
}
#review-stage,
#processing small,
#activity small {
  color: var(--mint);
}
#activity[data-state="confirmed"] {
  border-color: var(--mint);
}
#activity[data-state="rejected"],
#error:not(:empty) {
  border-left: 3px solid #f0976f;
  background: #342924;
  padding: 14px;
  color: #ffcfb9;
}
#error:not(:empty) {
  border-radius: 2px;
  margin: 12px 0;
}
#processing {
  border-color: var(--accent);
}
[hidden] {
  display: none !important;
}
@media (prefers-reduced-motion: no-preference) {
  /* each screen assembles: blocks rise one after another */
  [data-page]:not([hidden]) > *,
  #access:not([hidden]) > *,
  #activity:not([hidden]),
  #amount-step:not([hidden]) > *,
  .portfolio > * {
    animation: rise 0.55s var(--ease) backwards;
  }
  :is([data-page], #access, #amount-step) > :nth-child(2) {
    animation-delay: 70ms;
  }
  :is([data-page], #access, #amount-step) > :nth-child(3) {
    animation-delay: 140ms;
  }
  :is([data-page], #access, #amount-step) > :nth-child(n + 4) {
    animation-delay: 210ms;
  }
  .tiles button {
    animation: rise 0.6s var(--ease) 0.16s backwards;
  }
  .tiles button:nth-child(2) {
    animation-delay: 0.23s;
  }
  .tiles button:nth-child(3) {
    animation-delay: 0.3s;
  }
  #keypad button {
    animation: rise 0.4s var(--ease) backwards;
  }
  #keypad button:nth-child(n + 4) {
    animation-delay: 60ms;
  }
  #keypad button:nth-child(n + 7) {
    animation-delay: 120ms;
  }
  #keypad button:nth-child(n + 10) {
    animation-delay: 180ms;
  }
  dialog[open] {
    animation: sheet 0.5s var(--ease);
  }
  main::before,
  #access::before,
  .lock-cover::before,
  .portfolio::before {
    animation: drift 7s ease-in-out infinite alternate;
  }
  #access::after,
  .lock-cover::after,
  .portfolio::after {
    animation: drift 5s ease-in-out -2s infinite alternate-reverse;
  }
  @keyframes rise {
    from {
      opacity: 0;
      translate: 0 18px;
    }
  }
  @keyframes sheet {
    from {
      translate: 0 100%;
    }
  }
  @keyframes drift {
    to {
      translate: -34px 22px;
      scale: 1.12;
    }
  }
}
.review-ledger {
  margin: 0 0 1rem;
  display: grid;
  gap: 4px;
}
.review-ledger div {
  display: flex;
  justify-content: space-between;
  padding: 8px 11px;
  border-radius: 2px;
  background: #00000040;
}
.review-ledger dt {
  color: var(--mute);
  font-size: 0.82rem;
}
.review-ledger dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.site-approval #site {
  margin-top: 1.2rem;
}
.site-approval #site-origin {
  font-weight: 650;
  color: var(--mint);
}
#kernel-outcome:not(:empty),
#agent-status:not(:empty) {
  padding: 12px;
  border-left: 2px solid var(--accent);
  margin-block: 10px;
  background: var(--teal);
}
#receive-code {
  display: block;
  width: 178px;
  height: 178px;
  max-width: 100%;
  margin: 20px auto;
  border-radius: 2px;
  image-rendering: pixelated;
}
body:has(#access:not([hidden]), #lock-cover:not([hidden])) main::before {
  display: none;
}
/* headings take focus on navigation for screen readers; no visible box needed */
h2[tabindex="-1"]:focus-visible {
  outline: 0;
}
#amount:focus-visible {
  outline: 0;
  border-bottom: 2px solid var(--accent);
}
body[data-view="Send"] #keypad button {
  min-height: 44px;
}
body[data-view="Send"] #amount {
  font-size: 2.5rem;
  min-height: 40px;
  padding-block: 2px;
}
body[data-view="Send"] label {
  margin-block: 0;
}
body[data-view="Send"] #send {
  margin: 0;
}
body[data-view="Send"] [data-page="Send"] {
  padding-block: 2px;
}
#welcome-actions button {
  padding-inline: 0.3rem;
  font-size: 0.86rem;
}
