/* ==========================================================================
   LebCoin Wallet

   The explorer is a public reference and reads as institutional. This is
   personal money, in a country where institutional trust collapsed — so it is
   built to feel solid and tactile instead.

   The balance card is the one bold element: a banknote. Hairline border, cedar
   watermark, and the figure set in a serif rather than the geometric sans that
   every crypto wallet reaches for. Everything else stays quiet.

   Flag red appears only for locked state, destructive actions and errors.
   ========================================================================== */

:root {
  --paper:    #FCFCFA;
  --stone:    #EFEDE6;
  --stone-2:  #F6F5F0;
  --rule:     #D8D5CA;
  --rule-2:   #E9E7DF;

  --cedar:    #1B5E3F;
  --cedar-lo: #37805C;
  --cedar-pale:#E2EDE6;

  --flag:     #CE1126;
  --flag-pale:#FBE9EB;

  --ink:      #14201A;
  --muted:    #6B7A72;

  --display: 'Fraunces', Georgia, serif;
  --body:    'Inter', system-ui, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, monospace;

  --r: 3px;
  --wrap: 560px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--stone);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.skip {
  position: absolute; left: -999px; z-index: 100;
  background: var(--cedar); color: #fff; padding: 10px 16px;
}
.skip:focus { left: 8px; top: 8px; }

:focus-visible { outline: 2px solid var(--cedar); outline-offset: 2px; }

[hidden] { display: none !important; }

/* ─────────────────────────────────────────────────────────── header */

.top { background: var(--paper); border-bottom: 1px solid var(--rule); }
.top-in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 62px; padding-top: 10px; padding-bottom: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.cedar { width: 28px; height: 31px; color: var(--cedar); flex: none; }
.brandtext { display: flex; flex-direction: column; line-height: 1.08; }
.brandtext strong {
  font-family: var(--display); font-size: 19px; font-weight: 600;
  letter-spacing: -0.015em;
}
.brandtext em {
  font-style: normal; font-size: 10px; color: var(--muted);
  letter-spacing: 0.14em; text-transform: uppercase; font-weight: 500;
}

.topright { display: flex; align-items: center; gap: 12px; }
.chain {
  font-size: 11.5px; color: var(--muted); white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.chain::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
}
.chain[data-ok="1"]::before { background: var(--cedar-lo); }
.chain[data-ok="0"]::before { background: var(--flag); }

/* ──────────────────────────────────────────── the banknote (signature) */

.note-card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--cedar);
  padding: 26px 24px 22px;
  margin: 28px 0 20px;
  overflow: hidden;
}
/* Inner hairline, the way a note has a printed frame inside its edge. */
.note-card::before {
  content: ''; position: absolute; inset: 5px;
  border: 0.5px solid var(--rule);
  pointer-events: none;
}

.watermark {
  position: absolute; right: -14px; bottom: -18px;
  width: 168px; height: 185px;
  color: var(--cedar); opacity: 0.05;
  pointer-events: none;
}

.note-label {
  display: block; position: relative;
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--cedar); font-weight: 600; margin-bottom: 8px;
}

.note-figure {
  position: relative;
  font-family: var(--display);
  font-size: clamp(34px, 9vw, 46px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.note-figure .frac { color: var(--muted); font-size: 0.55em; }
.note-figure .unit {
  font-family: var(--body); font-size: 13px; font-weight: 600;
  color: var(--cedar); letter-spacing: 0.06em; margin-left: 8px;
  vertical-align: 0.6em;
}

.note-addr {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  margin-top: 16px; padding-top: 14px;
  border-top: 0.5px solid var(--rule);
}
.note-addr code {
  font-size: 11.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.note-pending {
  position: relative; margin: 12px 0 0; font-size: 12px; color: var(--muted);
}

.note-card.intro { padding: 28px 26px; }
.note-card.intro h1 {
  font-family: var(--display); font-size: 24px; font-weight: 600;
  margin: 0 0 10px; letter-spacing: -0.02em; position: relative;
}
.note-card.intro p { margin: 0; color: var(--muted); font-size: 14.5px; position: relative; }

/* ───────────────────────────────────────────────────────── panels */

.panel {
  background: var(--paper); border: 1px solid var(--rule);
  padding: 22px 22px 20px; margin-bottom: 20px;
}
.panel.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }
.panel.center { text-align: center; }
.panel.danger-edge { border-left: 3px solid var(--flag); }

.panel h2 {
  font-family: var(--display); font-size: 19px; font-weight: 600;
  margin: 0 0 6px; letter-spacing: -0.015em;
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.panel-head h2 { margin: 0; }

.lede { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

/* ───────────────────────────────────────────────────────── forms */

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
  margin-bottom: 6px;
}
.field input {
  width: 100%; font-family: var(--body); font-size: 15px;
  padding: 11px 13px; border: 1px solid var(--rule);
  border-radius: var(--r); background: var(--stone-2); color: var(--ink);
}
.field input.mono { font-family: var(--mono); font-size: 13px; }
.field input:focus { outline: none; border-color: var(--cedar); background: #fff; }

.amountrow { display: flex; gap: 8px; }
.amountrow input { flex: 1; min-width: 0; }

.meter { height: 3px; background: var(--rule-2); margin: -8px 0 6px; overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--flag); transition: width .2s, background .2s; }
.meter > i[data-level="2"] { background: #C08A12; }
.meter > i[data-level="3"] { background: var(--cedar-lo); }

.hint { margin: 0 0 14px; font-size: 12px; color: var(--muted); }
.error {
  margin: 0 0 14px; padding: 10px 12px; font-size: 13px;
  background: var(--flag-pale); border-left: 3px solid var(--flag); color: var(--ink);
}

.check { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0; font-size: 13.5px; }
.check input { margin-top: 3px; flex: none; }

/* ───────────────────────────────────────────────────────── buttons */

button, .ghost {
  font-family: var(--body); font-size: 14px; font-weight: 500;
  cursor: pointer; border-radius: var(--r); transition: background .12s, border-color .12s;
}
.primary {
  background: var(--cedar); border: 1px solid var(--cedar); color: #fff;
  padding: 11px 22px;
}
.primary:hover:not(:disabled) { background: #14472F; border-color: #14472F; }
.primary:disabled { opacity: .45; cursor: default; }

.secondary {
  background: var(--paper); border: 1px solid var(--rule); color: var(--ink);
  padding: 11px 22px;
}
.secondary:hover { border-color: var(--cedar); color: var(--cedar); }

.ghost {
  background: transparent; border: 1px solid var(--rule); color: var(--cedar);
  padding: 7px 14px; text-decoration: none; display: inline-block;
}
.ghost:hover { border-color: var(--cedar); }
.ghost.tiny { padding: 4px 10px; font-size: 12px; }

.big { flex: 1; padding: 14px 22px; font-size: 15px; }

.row { display: flex; gap: 10px; margin-top: 18px; }
.row.center { justify-content: center; }
.row > * { flex: 1; }
.row.center > * { flex: 0 0 auto; }

.choice { display: flex; gap: 12px; margin-bottom: 24px; }
.actions { display: flex; gap: 12px; margin-bottom: 22px; }

.linkbtn {
  background: none; border: 0; padding: 10px 0 0; color: var(--muted);
  font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px;
  display: block; margin: 0 auto;
}
.linkbtn:hover { color: var(--flag); }

/* ───────────────────────────────────────────────── secret + qr */

.secret {
  display: flex; gap: 10px; align-items: center;
  background: var(--stone-2); border: 1px solid var(--rule);
  padding: 14px; margin-bottom: 4px;
}
.secret code {
  font-family: var(--mono); font-size: 12.5px; word-break: break-all;
  flex: 1; min-width: 0; line-height: 1.5;
}

.qr {
  width: 200px; height: 200px; margin: 6px auto 16px;
  background: #fff; border: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: center;
}
.qr canvas, .qr img { display: block; }

.addr-big {
  display: block; font-size: 12.5px; word-break: break-all;
  color: var(--muted); margin-bottom: 18px; line-height: 1.6;
}

/* ───────────────────────────────────────────────────────── activity */

.txrow {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--rule-2);
}
.txrow:last-child { border-bottom: 0; }
.txmark {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  background: var(--cedar-pale); color: var(--cedar);
}
.txmark.out { background: var(--stone); color: var(--muted); }
.txbody { flex: 1; min-width: 0; }
.txbody a { font-family: var(--mono); font-size: 12px; color: var(--ink); text-decoration: none; }
.txbody a:hover { text-decoration: underline; }
.txtime { display: block; font-size: 11.5px; color: var(--muted); }
.txamt { font-family: var(--mono); font-size: 13.5px; white-space: nowrap; }
.txamt.in { color: var(--cedar); }

.empty { text-align: center; color: var(--muted); font-size: 13.5px; padding: 20px 0; margin: 0; }

.review {
  background: var(--stone-2); border: 1px solid var(--rule);
  padding: 14px 16px; margin: 4px 0 0;
}
.rrow {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 5px 0; font-size: 13.5px;
}
.rrow.total {
  border-top: 1px solid var(--rule); margin-top: 6px; padding-top: 10px;
  font-weight: 600;
}

/* ───────────────────────────────────────────────────────── footer */

.foot { margin-top: 40px; padding: 22px 0 30px; border-top: 1px solid var(--rule); }
.foot-in { text-align: center; }
.foot p { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.foot-meta { font-size: 11px; color: var(--muted); opacity: .8; }

/* ───────────────────────────────────────────────────── responsive */

@media (max-width: 480px) {
  .wrap { padding: 0 14px; }
  .choice, .actions { flex-direction: column; }
  .note-card { padding: 22px 18px 18px; }
  .panel { padding: 18px 16px 16px; }
  .row { flex-direction: column; }
  .row.center { flex-direction: row; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ─────────────────────────────────── recovery phrase

   Numbered because order is part of the secret — an unnumbered grid invites
   someone to copy the words down in the wrong sequence and only discover it
   when restoring, by which point the coins are unreachable. */

.phrase {
  list-style: none; counter-reset: w;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--rule);
  border: 1px solid var(--rule);
  margin: 4px 0 14px; padding: 0;
}
.phrase li {
  counter-increment: w;
  background: var(--stone-2);
  padding: 9px 10px 9px 32px;
  position: relative;
  font-family: var(--mono); font-size: 13px;
}
.phrase li::before {
  content: counter(w);
  position: absolute; left: 9px; top: 9px;
  font-family: var(--body); font-size: 10.5px;
  color: var(--muted); font-variant-numeric: tabular-nums;
}

.row.tight { margin-top: 0; margin-bottom: 12px; gap: 8px; }

.field textarea {
  width: 100%; font-family: var(--mono); font-size: 13px; line-height: 1.6;
  padding: 11px 13px; border: 1px solid var(--rule);
  border-radius: var(--r); background: var(--stone-2); color: var(--ink);
  resize: vertical;
}
.field textarea:focus { outline: none; border-color: var(--cedar); background: #fff; }

.field.small { display: inline-block; width: calc(33.333% - 8px); margin-right: 8px; }
.field.small:last-child { margin-right: 0; }

@media (max-width: 480px) {
  .phrase { grid-template-columns: repeat(2, 1fr); }
  .field.small { width: 100%; margin-right: 0; }
}
