/* wallet.css — layout and components for the RH Chain wallet.
 *
 * Built on the Zoltan token layer (assets/zoltan.css), which owns the identity:
 * CRT phosphor on basement black, mono display type, the glow. This file owns
 * structure only, so the brand can be restyled in one place.
 *
 * ONE DELIBERATE DEPARTURE FROM THE BRAND. rhchain.network leans hard on glow
 * and scanlines because it is a poster. A wallet is a place where people read
 * numbers that decide whether they have been robbed, so here the effects are
 * dialled back and contrast is dialled up: body copy is chrome, never phosphor
 * on a glow; amounts are mono and large; destructive things are the only red on
 * the screen. The identity survives in the palette and the type, not in the
 * bloom.
 *
 * Everything is sized for a phone first — this ships as an Android app around
 * the same markup — and widens to a single centred column on a desktop. There
 * is no wide layout, because a wallet has one thing to say at a time.
 */

@import url("zoltan.css");

* { box-sizing: border-box; }

html {
  /* Fills the notch/gesture areas on Android instead of letting the system
     paint them a different colour than the app. */
  background: var(--z-void);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--z-void);
  color: var(--z-fg);
  font: 15px/1.55 var(--z-sans);
  -webkit-font-smoothing: antialiased;
  /* Safe areas so content never sits under a phone's rounded corners. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior-y: none;
}

.app { max-width: 520px; margin: 0 auto; padding: 0 16px 96px; }

/* ------------------------------------------------------------ typography */

h1, h2, h3, h4 {
  font-family: var(--z-mono);
  letter-spacing: .04em;
  margin: 0 0 10px;
  color: var(--z-fg);
}
h1 { font-size: 19px; text-transform: uppercase; }
h2 { font-size: 16px; }
h3 { font-size: 13.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--z-muted); }
p { margin: 0 0 12px; }
a { color: var(--z-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--z-mono); font-size: .92em; }
.dim { color: var(--z-muted); }
.small { font-size: 12.5px; line-height: 1.5; }
.tiny { font-size: 11.5px; line-height: 1.45; }
.center { text-align: center; }
.break { word-break: break-all; }

/* ---------------------------------------------------------------- header */

.top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  height: 54px; margin: 0 -16px 14px; padding: 0 16px;
  background: rgba(7, 7, 11, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--z-line);
}
.top .mark { width: 22px; height: 22px; }
.top .name {
  font-family: var(--z-mono); font-size: 12.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: var(--z-track);
  color: var(--z-accent); white-space: nowrap;
}
.top .spacer { margin-left: auto; }

/* The network chip is not decoration: it is the difference between spending
   real ETH and spending nothing. Testnet is visually loud on purpose. */
.netchip {
  font-family: var(--z-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--z-line); background: var(--z-surface);
  color: var(--z-muted); cursor: pointer;
}
.netchip.live { color: var(--z-accent); border-color: color-mix(in srgb, var(--z-accent) 40%, transparent); }
.netchip.test { color: #ffb020; border-color: #6b4a10; background: #241a06; }

.iconbtn {
  background: none; border: 1px solid var(--z-line); color: var(--z-muted);
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
}
.iconbtn:hover { color: var(--z-accent); border-color: var(--z-accent); }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--z-surface);
  border: 1px solid var(--z-line);
  border-radius: var(--z-radius);
  padding: 16px;
  margin: 0 0 14px;
}
.card.flush { padding: 0; overflow: hidden; }
.card h3 { margin-bottom: 12px; }

/* The balance headline. The one place the glow is allowed, because it is the
   number people open the app to see. */
.balance { text-align: center; padding: 26px 16px 20px; }
.balance .amount {
  font-family: var(--z-mono); font-size: 34px; font-weight: 700;
  letter-spacing: -.01em; color: var(--z-fg); line-height: 1.1;
  overflow-wrap: anywhere;
}
.balance .amount .unit { font-size: 17px; color: var(--z-muted); margin-left: 6px; }
.balance .fiat { font-family: var(--z-mono); font-size: 14px; color: var(--z-accent); margin-top: 6px; }
.balance .addr {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  font-family: var(--z-mono); font-size: 12px; color: var(--z-muted);
  border: 1px solid var(--z-line); border-radius: 999px; padding: 6px 12px;
  cursor: pointer; background: none;
}
.balance .addr:hover { color: var(--z-accent); border-color: var(--z-accent); }

/* --------------------------------------------------------------- buttons */

.btn {
  font-family: var(--z-mono); font-size: 13px; letter-spacing: .04em;
  text-transform: uppercase; padding: 12px 16px; border-radius: 9px;
  border: 1px solid var(--z-line); background: var(--z-surface);
  color: var(--z-fg); cursor: pointer; min-height: 44px;   /* thumb-sized */
}
.btn:hover:not(:disabled) { border-color: var(--z-accent); color: var(--z-accent); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn.primary {
  background: var(--z-accent); color: #05130c; border-color: var(--z-accent);
  font-weight: 700;
}
.btn.primary:hover:not(:disabled) { box-shadow: var(--z-glow-sm); color: #05130c; }
.btn.danger { color: #ff6b6b; border-color: #5c2020; }
.btn.danger:hover:not(:disabled) { border-color: #ff6b6b; color: #ff6b6b; }
.btn.wide { width: 100%; }
.btn.ghost { background: none; }
.btn.small { padding: 8px 12px; font-size: 11.5px; min-height: 36px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.actions.three { grid-template-columns: repeat(3, 1fr); }

/* ------------------------------------------------------------------ tabs */

.tabs {
  display: flex; gap: 4px; margin: 0 0 14px;
  border-bottom: 1px solid var(--z-line);
}
.tabs button {
  flex: 1; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--z-muted); font-family: var(--z-mono); font-size: 12px;
  text-transform: uppercase; letter-spacing: .07em; padding: 11px 4px;
  cursor: pointer; min-height: 42px;
}
.tabs button[aria-selected="true"] { color: var(--z-accent); border-bottom-color: var(--z-accent); }

/* ------------------------------------------------------------------ rows */

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--z-line);
}
.row:last-child { border-bottom: none; }
.row .grow { flex: 1; min-width: 0; }
.row .label { font-size: 14px; color: var(--z-fg); }
.row .sub { font-size: 11.5px; color: var(--z-muted); font-family: var(--z-mono); }
.row .amount { font-family: var(--z-mono); font-size: 14px; text-align: right; white-space: nowrap; }
.row .amount .sub { font-size: 11px; }
.row.tappable { cursor: pointer; }
.row.tappable:hover { background: rgba(255, 255, 255, .025); }

.avatar {
  width: 34px; height: 34px; border-radius: 8px; flex: 0 0 auto;
  background: var(--z-void); border: 1px solid var(--z-line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--z-mono); font-size: 12px; color: var(--z-accent);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.dir-in { color: var(--z-accent); }
.dir-out { color: var(--z-chrome); }
.failed { color: #ff6b6b; }

/* ----------------------------------------------------------------- forms */

label.f { display: block; font-family: var(--z-mono); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .07em; color: var(--z-muted);
  margin: 0 0 6px; }
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; padding: 12px 13px; border-radius: 9px;
  border: 1px solid var(--z-line); background: var(--z-void);
  color: var(--z-fg); font: 15px/1.4 var(--z-mono);
  /* 16px on iOS avoids an auto-zoom on focus; Android is fine at 15. */
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--z-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--z-accent) 12%, transparent);
}
textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 11.5px; color: var(--z-muted); margin-top: 6px; }

/* --------------------------------------------------------------- notices */

.note {
  border-radius: 9px; padding: 12px 14px; margin: 0 0 14px;
  font-size: 13px; line-height: 1.5;
  border: 1px solid var(--z-line); background: var(--z-void);
}
.note.ok { border-color: #1f5c3c; background: #071a12; color: #9ff0c6; }
.note.warn { border-color: #6b4a10; background: #1c1405; color: #ffcf7a; }
.note.err { border-color: #5c2020; background: #1a0808; color: #ffabab; }
.note.info { border-color: #1d3a52; background: #06131c; color: #a8d4f0; }
.note strong { color: inherit; }

/* ---------------------------------------------------------------- modals */

.sheet {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(3, 3, 6, .78); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet .panel {
  width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  background: var(--z-void-2); border: 1px solid var(--z-line);
  border-radius: 16px 16px 0 0; padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  animation: rise .16s ease-out;
}
@media (min-width: 560px) {
  .sheet { align-items: center; }
  .sheet .panel { border-radius: 14px; }
}
@keyframes rise { from { transform: translateY(14px); opacity: .6 } to { transform: none; opacity: 1 } }
@media (prefers-reduced-motion: reduce) { .sheet .panel { animation: none } }

/* --------------------------------------------------------------- the NFT grid */

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 460px) { .grid { grid-template-columns: repeat(3, 1fr) } }
.nft {
  border: 1px solid var(--z-line); border-radius: 10px; overflow: hidden;
  background: var(--z-surface); cursor: pointer;
}
.nft .art {
  aspect-ratio: 1; background: var(--z-void); display: flex;
  align-items: center; justify-content: center; overflow: hidden;
}
.nft .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nft .art .ph { font-family: var(--z-mono); font-size: 11px; color: var(--z-muted); padding: 8px; text-align: center; }
.nft .cap { padding: 8px 10px; }
.nft .cap .t { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nft .cap .s { font-family: var(--z-mono); font-size: 10.5px; color: var(--z-muted); }
.nft .tba { font-family: var(--z-mono); font-size: 10px; color: var(--z-accent); padding: 0 10px 8px; }

/* ------------------------------------------------------------------ misc */

.spin {
  display: inline-block; width: 15px; height: 15px; vertical-align: -2px;
  border: 2px solid var(--z-line); border-top-color: var(--z-accent);
  border-radius: 50%; animation: sp .7s linear infinite;
}
@keyframes sp { to { transform: rotate(360deg) } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2s } }

.empty { text-align: center; padding: 34px 16px; color: var(--z-muted); font-size: 13.5px; }

.words {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  font-family: var(--z-mono); font-size: 13px;
}
.words span {
  background: var(--z-void); border: 1px solid var(--z-line);
  border-radius: 7px; padding: 8px 6px 8px 26px; position: relative;
}
.words span::before {
  content: attr(data-i); position: absolute; left: 7px; color: var(--z-muted); font-size: 10px;
}

.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
.kv th {
  text-align: left; font-weight: 400; color: var(--z-muted); font-family: var(--z-mono);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  padding: 9px 10px 9px 0; vertical-align: top; width: 40%;
}
.kv td { padding: 9px 0; vertical-align: top; word-break: break-word; }
.kv tr { border-bottom: 1px solid var(--z-line); }
.kv tr:last-child { border-bottom: none; }

.qr { display: block; margin: 0 auto; image-rendering: pixelated;
  background: #fff; padding: 10px; border-radius: 10px; }

/* The confirm screen deliberately looks different from every other screen —
   it is the last moment before money moves, and it should not feel routine. */
.confirm .headline {
  font-family: var(--z-mono); font-size: 26px; text-align: center;
  padding: 8px 0 4px; overflow-wrap: anywhere;
}
.confirm .to { text-align: center; color: var(--z-muted); font-family: var(--z-mono);
  font-size: 12px; margin-bottom: 16px; overflow-wrap: anywhere; }
