/* QUANTUM21 wallet. One bold element: the balance "vault" — engraved gold numerals on navy
   over a lattice (ML-DSA is lattice cryptography). Everything else stays quiet. */

@font-face { font-family: "Golos"; font-weight: 400; font-display: swap;
  src: url(fonts/golos-text-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Golos"; font-weight: 500; font-display: swap;
  src: url(fonts/golos-text-latin-500-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Golos"; font-weight: 600; font-display: swap;
  src: url(fonts/golos-text-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Golos"; font-weight: 400; font-display: swap;
  src: url(fonts/golos-text-cyrillic-400-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos"; font-weight: 500; font-display: swap;
  src: url(fonts/golos-text-cyrillic-500-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos"; font-weight: 600; font-display: swap;
  src: url(fonts/golos-text-cyrillic-600-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fraunces"; font-weight: 100 900; font-display: swap;
  src: url(fonts/fraunces-latin-wght-normal.woff2) format("woff2"); }

:root {
  --fog: #E9EDF3;       /* page */
  --paper: #FFFFFF;     /* surfaces */
  --ink: #13213C;       /* text */
  --muted: #5A6880;     /* secondary text */
  --line: #D3DAE5;      /* dividers, outlines */
  --navy: #0F2246;      /* brand, primary actions */
  --gold: #CFA93A;      /* brand accent, sparingly */
  --gold-pale: #EADBA8; /* numerals on navy */
  --good: #1D7651;
  --bad: #B3261E;
  --radius: 12px;
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-4: clamp(2.6rem, 11vw, 3.6rem);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fog);
  color: var(--ink);
  font: 400 var(--step-0)/1.55 "Golos", system-ui, sans-serif;
}
.app {
  max-width: 30rem;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1.25rem max(1.5rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
main { flex: 1; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.25rem 0 1.5rem; }
.mark { font: 600 1.35rem/1 "Fraunces", Georgia, serif; color: var(--navy); letter-spacing: 0.01em; }
.mark span { color: var(--gold); }
.net { font-size: var(--step--1); color: var(--muted); display: inline-flex; align-items: center; gap: 0.45rem; }
.net::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--line); }
.net[data-state="ok"]::before { background: var(--good); }
.net[data-state="slow"]::before { background: var(--gold); }
.net[data-state="down"]::before { background: var(--bad); }

/* text */
h1 { font: 600 var(--step-2)/1.2 "Golos", system-ui, sans-serif; margin: 0.5rem 0 0.75rem; letter-spacing: -0.01em; }
h2 { font: 600 var(--step-1)/1.3 "Golos", system-ui, sans-serif; margin: 2rem 0 0.75rem; }
h1:focus, h2:focus { outline: none; }
.lead { color: var(--muted); margin: 0 0 1.5rem; max-width: 34em; }
.note { font-size: var(--step--1); color: var(--muted); margin-top: 2rem; }
.err { color: var(--bad); margin: 0; min-height: 1.2em; font-size: var(--step--1); }
.err:empty { min-height: 0; }
.hint, .empty { color: var(--muted); font-size: var(--step--1); margin: 0; }

/* layout helpers */
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.stack.tight { gap: 0.5rem; }

/* controls */
.btn {
  appearance: none; font: 500 var(--step-0)/1.2 "Golos", system-ui, sans-serif;
  padding: 0.85rem 1.1rem; border-radius: var(--radius);
  border: 1.5px solid var(--navy); background: transparent; color: var(--navy);
  cursor: pointer; min-height: 3rem;
}
.btn.primary { background: var(--navy); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.quiet { border-color: transparent; color: var(--muted); }
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn.quiet:hover:not(:disabled) { color: var(--ink); filter: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--navy); text-decoration: underline; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.field { display: flex; flex-direction: column; gap: 0.35rem; font-size: var(--step--1); color: var(--muted); }
input, textarea {
  font: 400 var(--step-0)/1.4 "Golos", system-ui, sans-serif; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 10px;
  padding: 0.75rem 0.85rem; width: 100%;
}
input:focus, textarea:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgb(207 169 58 / 0.35); }
textarea { resize: vertical; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; margin: 1.25rem 0; }
.check input { width: 1.2rem; height: 1.2rem; margin-top: 0.15rem; accent-color: var(--navy); }

/* the 24 words: a real sequence, so numbered */
.words {
  list-style: none; counter-reset: w; padding: 1rem; margin: 0;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.55rem 0.75rem;
}
.words li { counter-increment: w; font-weight: 500; font-variant-numeric: tabular-nums; }
.words li::before { content: counter(w) "."; display: inline-block; min-width: 2.1em; color: var(--muted); font-weight: 400; font-size: var(--step--1); }
@media (max-width: 360px) { .words { grid-template-columns: repeat(2, 1fr); } }

/* the vault: the one bold element */
.vault {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: 1.6rem 1.5rem 1.4rem; border-radius: 18px;
  background-color: var(--navy); color: var(--gold-pale);
  background-image:
    radial-gradient(circle at center, rgb(207 169 58 / 0.3) 1.1px, transparent 1.6px),
    radial-gradient(circle at center, rgb(207 169 58 / 0.3) 1.1px, transparent 1.6px);
  background-size: 22px 22px, 22px 22px;
  background-position: 0 0, 11px 11px;
}
.vault::after { /* soft vignette so numerals sit on calm navy */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 20% 35%, rgb(15 34 70 / 0.92) 35%, rgb(15 34 70 / 0.35) 100%);
}
.vault > * { position: relative; z-index: 1; }
.vault-label { font-size: var(--step--1); color: rgb(234 219 168 / 0.75); }
.amount { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
#balance {
  font: 500 var(--step-4)/1 "Fraunces", Georgia, serif; font-variant-numeric: lining-nums tabular-nums;
  color: var(--gold-pale); letter-spacing: -0.02em; overflow-wrap: anywhere;
}
.unit { font: 600 var(--step-1)/1 "Golos", system-ui, sans-serif; color: var(--gold); }
.vault-sub { font-size: var(--step--1); color: rgb(234 219 168 / 0.8); min-height: 1.3em; white-space: pre-wrap; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1rem; }
.actions #faucet { grid-column: 1 / -1; }

/* history: a plain ledger, not cards */
.history { list-style: none; padding: 0; margin: 0; }
.history li {
  display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 1rem;
  padding: 0.85rem 0; border-bottom: 1px solid var(--line);
}
.history li[data-pending] { opacity: 0.7; }
.what { font-weight: 500; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.delta.in { color: var(--good); }
.delta.out { color: var(--ink); }
.when, .txid { font-size: var(--step--1); color: var(--muted); }
.txid { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 0.5rem 0 1rem; }
#lock { margin-top: 1.5rem; align-self: center; width: 100%; }

.addr, .addr-small, .mono-wrap {
  overflow-wrap: anywhere; word-break: break-all; font-variant-numeric: tabular-nums;
}
.addr { background: var(--fog); border-radius: 10px; padding: 0.75rem; font-size: var(--step--1); margin: 0 0 1rem; }
.addr-small { color: var(--muted); font-size: var(--step--1); margin: 0 0 1rem; }

/* sheets (dialogs) */
.sheet {
  border: 0; padding: 1.5rem 1.25rem max(1.25rem, env(safe-area-inset-bottom));
  width: min(30rem, 100%); max-width: 100%; max-height: 92dvh;
  border-radius: 18px; background: var(--paper); color: var(--ink);
}
.sheet::backdrop { background: rgb(15 34 70 / 0.55); }
.sheet h2 { margin-top: 0; }
@media (max-width: 600px) {
  .sheet { margin: auto 0 0; border-radius: 18px 18px 0 0; }
}
.qr { width: min(15rem, 70vw); margin: 0 auto 1rem; }
.qr svg { display: block; width: 100%; height: auto; border-radius: 8px; }
.review { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1rem; margin: 0 0 0.5rem; }
.review dt { color: var(--muted); font-size: var(--step--1); padding-top: 0.15rem; }
.review dd { margin: 0; font-weight: 500; }
.review dd#r-total { font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: max(1.25rem, env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: min(26rem, calc(100% - 2rem)); padding: 0.75rem 1rem; border-radius: 10px;
  background: var(--ink); color: #fff; font-size: var(--step--1); z-index: 10;
}

.foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2.5rem; font-size: var(--step--1); color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .sheet[open] { animation: rise 180ms ease-out; }
  @keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
}
