/* Reading surfaces and the cashier. Opaque plates keep financial text independent
   of the moving water. Community content has its own stylesheet. */
#wallet-modal, #modal {
  padding: 24px;
  background: rgba(1, 6, 12, .9);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
#wallet-modal .wallet-sheet, #modal > .sheet {
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  padding: 34px;
  border: 1px solid rgba(177, 199, 211, .23);
  border-top: 2px solid #9ec7d0;
  border-radius: 10px;
  background:
    radial-gradient(ellipse at 100% 0, #38576a1f, transparent 45%),
    linear-gradient(135deg, #122330, #0b1823 55%);
  box-shadow: 0 30px 100px rgba(0, 0, 0, .65), inset 0 1px rgba(228, 242, 249, .08);
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(160, 189, 205, .3) transparent;
}
#wallet-modal:not(.you-open) .wallet-sheet { width: min(700px, 100%); }
#wallet-modal:not(.hidden), #modal:not(.hidden) { animation: panel-scrim-in .18s ease-out both; }
#wallet-modal:not(.hidden) > .sheet, #modal:not(.hidden) > .sheet {
  animation: panel-sheet-in .20s cubic-bezier(.2, .7, .2, 1) both;
}
#wallet-modal [role="tabpanel"]:not(.hidden) {
  animation: panel-content-in .18s ease-out both;
}
@keyframes panel-scrim-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes panel-sheet-in {
  from { opacity: .5; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes panel-content-in {
  from { opacity: .45; }
  to { opacity: 1; }
}
#wallet-modal .close, #modal .close {
  /* A zero-height float reserves the original header corner; sticky keeps the
     control reachable when the sheet scrolls through a statement or guide. */
  position: sticky; top: -6px; right: auto;
  float: right; margin: -6px -6px -38px 0; z-index: 12;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 7px;
  background: #182c39;
  border-color: rgba(175, 201, 215, .16);
  color: var(--ink-dim);
  font-family: var(--ui); font-size: 24px; font-weight: 400;
  transition: color .16s, background .16s, border-color .16s;
}
#wallet-modal .close:hover, #modal .close:hover {
  color: var(--ink-hi);
  background: #253e4d;
  border-color: rgba(175, 201, 215, .3);
}
#wallet-modal .close:active, #modal .close:active {
  background: #122633;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.28);
}
/* The guide's sticky tab scroller and sticky close share the top edge. Reserve
   viewport width, so even horizontally scrolled links stay clear of the close. */
#modal .guide-nav { margin-right: 58px; box-shadow: 58px 0 #0c1c28; }
#wallet-modal :is(button, input, a):focus-visible,
#modal :is(button, input, a):focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 3px;
}
#wallet-modal :is(button, .btn-quiet):active:not(:disabled) { transform: none; }

/* Identity, network disclosure, then the asset control. The network's server
   wording stays visible above every wallet tab. */
.wallet-heading {
  display: flex; align-items: center; gap: 14px;
  min-height: 44px;
  margin: 0 52px 28px 0;
}
#wallet-modal .wallet-heading .sheet-title {
  margin: 0;
  color: #f0ede4;
  font-family: var(--ui); font-size: 40px; font-weight: 600;
  letter-spacing: -.035em; line-height: 1.15;
  min-width: 0; overflow-wrap: anywhere;
}
.wallet-heading-mark {
  display: grid; place-items: center; flex: none;
  width: 46px; height: 46px;
  color: #c0dce3;
  border: 1px solid rgba(165,207,221,.25); border-radius: 8px;
  background: #172d3a;
  box-shadow: inset 0 1px rgba(226,244,250,.1);
}
.wallet-heading-mark svg { width: 28px; height: 28px; stroke: currentColor; stroke-width: 1.25; }
#wallet-modal #wallet-net {
  margin: 0 0 22px;
  padding: 11px 14px;
  border: 0; border-left: 2px solid rgba(232, 178, 58, .55);
  border-radius: 0 4px 4px 0;
  background: rgba(232, 178, 58, .055);
  color: var(--amber);
  font-family: var(--ui); font-size: 12px; line-height: 1.6; letter-spacing: .015em;
  overflow-wrap: anywhere;
}
#wallet-modal #wallet-net.live {
  color: #efc38f; border-left-color: rgba(239, 195, 143, .65);
  background: rgba(239, 195, 143, .06);
}
#wallet-modal .asset-row {
  justify-content: space-between; gap: 16px;
  margin: 0 0 24px; padding: 0;
}
#wallet-modal .asset-lbl {
  font-family: var(--ui); font-size: 11px; font-weight: 600;
  color: var(--ink-dim); letter-spacing: .1em;
}
#wallet-modal .asset-row .purse { min-width: 0; }
#wallet-modal .asset-row .purse-bal {
  justify-content: flex-start; gap: 10px;
  min-width: 156px; min-height: 50px; padding: 9px 12px;
  background: #162c39;
  border: 1px solid rgba(175, 201, 215, .23); border-radius: 6px;
  box-shadow: inset 0 1px rgba(229, 243, 248, .06), 0 3px 6px rgba(0, 0, 0, .1);
  transition: border-color .16s ease, box-shadow .16s ease;
}
#wallet-modal .asset-row .purse-bal:hover {
  border-color: rgba(174, 207, 223, .48);
  background: linear-gradient(180deg, #293f4d, #1b303e);
}
#wallet-modal .asset-row .purse-bal:active {
  transform: none;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.3), inset 0 -1px rgba(222,240,248,.08);
}
#wallet-modal .asset-row .purse-bal[aria-expanded="true"] { border-color: rgba(165,219,235,.52); }
#wallet-modal .asset-row .purse-bal .val {
  font-family: var(--ui); font-size: 16px; letter-spacing: .015em; font-weight: 700;
}
#wallet-modal .asset-row .purse-bal .coin { order: -1; width: 26px; height: 26px; font-size: 14px; }
#wallet-modal .asset-row .purse-bal .chev { margin-left: auto; }
#wallet-modal .asset-menu {
  left: auto; right: 0;
  min-width: min(260px, calc(100vw - 56px));
  padding: 6px;
  background: #132632;
  border-color: rgba(174, 207, 223, .3);
  box-shadow: 0 18px 45px rgba(0, 0, 0, .5);
}
#wallet-modal .asset-menu li { margin: 0; }
#wallet-modal .asset-menu:not(.hidden) { animation: panel-content-in .16s ease-out both; }
#wallet-modal .asset-menu button { min-height: 48px; font-family: var(--ui); }
#wallet-modal .asset-menu .sym { font-size: 13px; }

/* Destination tabs use a clear baseline so navigation stays distinct from actions. */
#wallet-modal .wtabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 30px; padding: 0;
  border: 0; border-bottom: 1px solid rgba(139, 168, 185, .24); border-radius: 0;
  background: transparent;
}
#wallet-modal .wtabs button {
  min-height: 49px; padding: 12px 8px;
  border: 0; border-radius: 0;
  background: transparent;
  color: var(--ink-dim);
  font-family: var(--ui); font-size: 13px; font-weight: 600;
  transition: color .16s ease, background .16s ease, border-color .16s ease, box-shadow .18s ease;
}
#wallet-modal .wtabs button:hover { color: var(--ink); background: rgba(170, 195, 209, .07); }
#wallet-modal .wtabs button[aria-selected="true"] {
  color: #e7eff1;
  background: linear-gradient(0deg, #97c9d411, transparent);
  border-color: transparent;
  box-shadow: inset 0 -2px #a7d2dc;
}
#wallet-modal .wtabs button:active { box-shadow: inset 0 2px 5px rgba(0,0,0,.26); }

body.watching #wallet-modal .wtabs { grid-template-columns: minmax(0, 1fr); }

/* Transaction forms: readable guidance, generous fields, then the action. */
#wallet-modal :where(#pane-deposit, #pane-withdraw) .small {
  color: #b9cdd8; font-size: 13px; line-height: 1.7;
}
#wallet-modal :where(#pane-deposit, #pane-withdraw) .wallet-guidance {
  margin: 0 0 24px; padding: 16px 18px;
  border: 1px solid rgba(160,192,210,.16); border-radius: 6px;
  background: #142a36;
  font-size: 14px; line-height: 1.65;
}
#wallet-modal .wallet-guidance b { color: #e3eff4; font-weight: 650; }
#wallet-modal :where(#pane-deposit, #pane-withdraw) label {
  margin: 0 0 18px;
  color: var(--ink-dim);
  font-family: var(--ui); font-size: 12px; font-weight: 600;
  letter-spacing: .025em; line-height: 1.5;
}
#wallet-modal :where(#pane-deposit, #pane-withdraw) input {
  display: block; margin-top: 9px; min-width: 0;
  min-height: 56px; padding: 15px 16px;
  background: #06131e;
  color: var(--ink);
  border: 1px solid rgba(168, 198, 215, .28); border-radius: 6px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .14);
  font-family: var(--mono); font-size: 14px; font-weight: 400;
  letter-spacing: 0; text-transform: none;
  transition: border-color .16s, background .16s;
}
#wallet-modal :where(#pane-deposit, #pane-withdraw) input:hover { border-color: rgba(169, 206, 226, .4); }
#wallet-modal :where(#pane-deposit, #pane-withdraw) input:focus {
  background: #091b28; border-color: var(--edge-live);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.14), 0 0 0 1px rgba(135,210,229,.16);
}
#wallet-modal :where(#pane-deposit, #pane-withdraw) input::placeholder {
  color: #7893a5; opacity: 1; font-family: var(--ui);
}
#wallet-modal .wallet-address-block {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: end; gap: 12px;
  margin: 0 0 22px;
}
#wallet-modal .wallet-address-block label { min-width: 0; margin: 0; }
#wallet-modal :where(#pane-deposit, #pane-withdraw) .btn-quiet {
  display: inline-flex; justify-content: center; align-items: center; gap: 9px;
  min-height: 56px; margin: 0;
  padding: 12px 18px;
  background: #1d3544;
  border: 1px solid rgba(175, 205, 222, .28); border-radius: 6px;
  color: var(--ink);
  font-family: var(--ui); font-size: 13px; font-weight: 600; letter-spacing: .01em;
  box-shadow: inset 0 1px rgba(229, 243, 248, .07), 0 4px 8px rgba(0, 0, 0, .13);
  transition: background .16s, border-color .16s;
}
#wallet-modal :where(#pane-deposit, #pane-withdraw) .btn-quiet:hover:not(:disabled) {
  background: linear-gradient(180deg, #314c5e, #243c4c); border-color: rgba(184, 215, 231, .45);
}
#wallet-modal :where(#pane-deposit, #pane-withdraw) .btn-quiet:active:not(:disabled) {
  transform: none; box-shadow: inset 0 2px 5px rgba(0,0,0,.22), inset 0 -1px rgba(218,240,249,.12);
}
#wallet-modal #dep-copy svg { width: 17px; height: 17px; flex: none; stroke: currentColor; stroke-width: 1.4; }
#wallet-modal #dep-faucet { width: 100%; margin: 0 0 8px; }
#wallet-modal .wallet-amount-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start; gap: 22px;
  margin: 0 0 22px;
}
#wallet-modal .wallet-amount-grid label { margin: 0; }
#wallet-modal #wd-amt { font-family: var(--ui); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
#wallet-modal .wallet-available {
  margin: 0; padding: 16px 18px; min-width: 0;
  border: 1px solid rgba(160,192,210,.2); border-radius: 6px;
  background: #142936;
  box-shadow: inset 0 1px rgba(216,238,247,.035);
}
#wallet-modal .wallet-available-k {
  display: block; margin-bottom: 9px;
  font-size: 11px; font-weight: 600; letter-spacing: .045em; text-transform: uppercase;
}
#wallet-modal .wallet-available-value {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px;
  min-height: 38px; padding: 0;
}
#wallet-modal #wd-avail {
  color: var(--ink-hi); font-family: var(--ui); font-size: 32px;
  font-weight: 600; letter-spacing: -.035em; line-height: 1.3;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
#wallet-modal #wd-sym { font-size: 11px; color: var(--ink-dim); }
#wallet-modal #wd-min { font-size: 11px; }
#wallet-modal #wd-submit {
  width: 100%; min-height: 56px;
  color: #091d28;
  background: #b8dbe1;
  border-color: rgba(214, 240, 248, .3);
  font-size: 14px; font-weight: 700;
  box-shadow: inset 0 1px rgba(239, 251, 255, .25), 0 5px 14px rgba(0, 0, 0, .18);
}
#wallet-modal #wd-submit:hover:not(:disabled) { background: #d0e9ed; }
#wallet-modal #wd-submit:disabled { opacity: .45; box-shadow: none; }

/* Incoming confirmations are a quiet, live readout. Motion never suggests that
   the confirmation count is progressing faster than the server says. */
#wallet-modal .dep-now {
  margin: 0 0 24px; padding: 22px;
  background: linear-gradient(120deg, #183436, #10242d);
  border: 1px solid rgba(115, 186, 173, .24); border-radius: 6px;
  box-shadow: inset 0 1px rgba(176, 226, 215, .04);
}
#wallet-modal .dep-now .dep-now-k {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 10px; color: #a6c7c5;
  font-family: var(--ui); font-size: 11px; font-weight: 600; letter-spacing: .09em;
}
#wallet-modal .dep-now-k::before {
  content: ""; width: 5px; height: 5px; flex: none;
  border-radius: 50%; background: #8ec8ba;
}
#wallet-modal .dep-now .dep-now-amt {
  margin: 0 0 10px;
  color: var(--ink-hi); font-family: var(--ui); font-size: 32px;
  font-weight: 600; line-height: 1.2; letter-spacing: -.025em;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
#wallet-modal .dep-now-bar { margin: 14px 0 6px; height: 4px; background: rgba(121, 174, 170, .15); }
#wallet-modal .dep-now-bar i { background: #87c3b3; }
#wallet-modal .dep-tx {
  display: inline-flex; align-items: center; min-height: 44px;
  color: #b2d8e3; font-size: 12px; text-underline-offset: 4px;
}
#wallet-modal :is(#dep-status, #wd-status) {
  margin: 20px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid rgba(169, 196, 211, .12);
  overflow-wrap: anywhere;
}
#wallet-modal #wd-status:empty { display: none; }
#wallet-modal .dep-line + .dep-line { margin-top: 10px; }
#wallet-modal #wd-open-h { margin: 24px 0 12px; }
#wallet-modal #wd-open { gap: 8px; margin: 0; }
#wallet-modal #wd-open .board-row.wd {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "rank mult" "over over";
  align-items: baseline; gap: 8px 16px;
  padding: 15px 16px;
  background: rgba(87, 120, 141, .065);
  border-color: rgba(158, 189, 207, .2); border-radius: 6px;
}
#wallet-modal #wd-open .board-rank { text-align: left; color: var(--ink-dim); }
#wallet-modal #wd-open .board-mult {
  text-align: right; color: var(--ink);
  font-family: var(--ui); font-size: 21px; font-weight: 600;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
#wallet-modal #wd-open .board-over {
  font-family: var(--ui); font-size: 12px; line-height: 1.65;
  color: var(--ink-dim); white-space: normal; overflow: visible;
  overflow-wrap: anywhere;
}
#wallet-modal #dep-chain-warn {
  margin: -6px 0 22px; padding: 10px 12px;
  color: var(--amber); background: rgba(232, 178, 58, .06);
  border-left-color: rgba(232, 178, 58, .6);
}


/* The large destination label is followed by a smaller task heading. */
.wallet-heading-copy { min-width: 0; }
.wallet-eyebrow {
  display: block; margin-bottom: 8px; color: #8fa8b8;
  font: 500 9px/1.4 var(--mono); letter-spacing: .16em;
}
.wallet-pane-heading { margin: 0 0 24px; }
#wallet-modal .wallet-pane-heading h4 {
  margin: 0 0 8px; color: #eeece4;
  font: 500 24px/1.25 var(--ui); letter-spacing: -.025em; text-transform: none;
}
#wallet-modal .wallet-pane-heading p {
  margin: 0; color: #acbfcb; font: 400 13px/1.65 var(--ui);
}
#wallet-modal .wallet-heading-mark { position: relative; }
#wallet-modal .wallet-heading-mark::after {
  content: ''; position: absolute; inset: -5px; border: 1px solid #a8d5df12; border-radius: 11px;
  pointer-events: none;
}
#wallet-modal .asset-lbl { color: #a8bbc7; }
#wallet-modal #dep-addr { font-size: 13px; color: #d8e6ed; }
#wallet-modal :is(#dep-status, #wd-status, #stmt-status) { line-height: 1.8; }
#wallet-modal .wallet-amount-grid { align-items: stretch; }
#wallet-modal #wd-open-h { color: #d5e1e7; font-size: 13px; letter-spacing: .025em; }
#wallet-modal .wallet-guidance, #wallet-modal .wallet-available { box-shadow: none; }
#wallet-modal .wallet-guidance b { color: #eeece4; }
#wallet-modal #dep-copy:disabled { opacity: .5; }
#wallet-modal #dep-copy:focus-visible { outline-offset: 3px; }

@media (min-width: 800px) {
  /* Asset selection belongs to the destination header; giving it a separate
     full-width row pushes every form and record below the first viewport. */
  #wallet-modal:not(.you-open) .wallet-heading { margin-right: 270px; min-height: 70px; }
  #wallet-modal:not(.you-open) .asset-row {
    position: absolute; top: 47px; right: 92px;
    margin: 0; gap: 10px;
  }
  #wallet-modal:not(.you-open) .asset-lbl { font-size: 9px; }
  #wallet-modal:not(.you-open) .asset-row .purse-bal { min-width: 128px; }
}

@media (max-width: 640px) {
  #wallet-modal, #modal { padding: 12px; }
  #wallet-modal .wallet-sheet, #modal > .sheet {
    max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px);
    padding: 24px; border-radius: 9px;
  }
  .wallet-heading { margin-bottom: 24px; gap: 12px; }
  #wallet-modal .wallet-pane-heading h4 { font-size: 23px; }
  #wallet-modal .wallet-heading .sheet-title { font-size: 34px; }
  #wallet-modal .asset-row { margin-bottom: 18px; }
  #wallet-modal .wtabs { margin-bottom: 22px; }
  #wallet-modal .wallet-address-block { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  #wallet-modal #dep-copy { justify-self: stretch; }
  #wallet-modal .wallet-amount-grid { gap: 18px; }
  #wallet-modal #wd-avail { font-size: 24px; }
}
@media (max-width: 480px) {
  #wallet-modal .wallet-amount-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  #wallet-modal .wallet-available { padding: 14px; }
  #wallet-modal .wallet-available-k { margin-bottom: 6px; }
  #wallet-modal .wallet-available-value { min-height: 0; padding: 0; }
}
@media (max-width: 380px) {
  #wallet-modal, #modal { padding: 8px; }
  #wallet-modal .wallet-sheet, #modal > .sheet {
    max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px);
    padding: 19px; border-radius: 8px;
  }
  #wallet-modal .wtabs { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; }
  #wallet-modal .wtabs button { min-height: 44px; padding: 10px 2px; font-size: 11px; }
  #wallet-modal .wallet-heading { margin-bottom: 18px; }
  #wallet-modal #wallet-net { margin-bottom: 16px; padding: 9px 11px; }
  #wallet-modal .asset-row { margin-bottom: 14px; }
  #wallet-modal .asset-row .purse-bal { min-height: 46px; }
  #wallet-modal .wallet-pane-heading { margin-bottom: 20px; }
  #wallet-modal .wallet-heading .sheet-title { font-size: 30px; }
  .wallet-heading { gap: 10px; }
  .wallet-eyebrow { font-size: 8px; letter-spacing: .1em; }
  #wallet-modal .wallet-pane-heading h4 { font-size: 21px; }
  .wallet-heading-mark { width: 36px; height: 40px; }
  #wallet-modal .asset-row .purse-bal { min-width: 146px; }
  #wallet-modal .wallet-amount-grid { gap: 14px; }
  #wallet-modal #wd-avail { font-size: 22px; }
  #wallet-modal .dep-now { padding: 16px; }
  #wallet-modal .dep-now .dep-now-amt { font-size: 34px; }
}
@media (pointer: coarse) {
  #wallet-modal :where(#pane-deposit, #pane-withdraw) input { font-size: 16px; }
  #wallet-modal #wd-amt { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  #wallet-modal, #modal { animation: none !important; }
  #wallet-modal *, #modal * { transition: none !important; animation: none !important; }
}
