/* Pearl Escrow — bonded-ledger theme: deep forest green, brass, parchment ink. */
:root {
  --bg: #0b1f16;
  --bg2: #0e2a1e;
  --panel: #122e21;
  --panel2: #163626;
  --line: #2a4a38;
  --ink: #eef3e6;
  --muted: #a9bfa9;
  --brass: #d8a94e;
  --brass-hi: #f2cd7e;
  --brass-dim: #8a6c33;
  --green: #7fd08a;
  --red: #e88a7d;
  --code: #0a1a12;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: radial-gradient(1200px 600px at 50% -10%, #143723 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--ink); font: 16px/1.55 -apple-system, "Segoe UI", Roboto, sans-serif;
}
.topbar {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem; border-bottom: 2px solid var(--brass-dim);
  background: linear-gradient(180deg, #0f2c1f, #0b1f16);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; gap: .8rem; align-items: center; }
.brand .seal { width: 40px; height: 40px; color: var(--brass); }
.brand h1 { margin: 0; font-size: 1.5rem; letter-spacing: .02em; color: var(--brass-hi); font-family: Georgia, "Times New Roman", serif; }
.tagline { margin: 0; color: var(--muted); font-size: .9rem; }
.steps { display: flex; gap: .4rem; flex-wrap: wrap; }
.steps button {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  padding: .45rem .8rem; border-radius: 999px; cursor: pointer; font-size: .85rem;
}
.steps button.active { border-color: var(--brass); color: var(--brass-hi); background: #1a3a29; }
.steps button.done { border-color: var(--green); color: var(--green); }
main { max-width: 980px; margin: 0 auto; padding: 1.5rem; }
.panel { display: none; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.6rem; margin-bottom: 1.5rem; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.panel.active { display: block; }
.panel h2 { margin-top: 0; color: var(--brass-hi); font-family: Georgia, serif; }
.panel h3 { color: var(--brass); margin: 1.4rem 0 .6rem; font-family: Georgia, serif; }
.panel h4 { margin: .8rem 0 .3rem; color: var(--ink); }
.lede { color: var(--muted); max-width: 70ch; }
.lede strong { color: var(--ink); }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin: 1rem 0; }
.form-grid .wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; color: var(--muted); }
input, select, textarea {
  background: var(--code); border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; padding: .6rem .7rem; font-size: .95rem; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brass-dim); border-color: var(--brass); }
input[readonly] { color: var(--muted); }
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; resize: vertical; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 1.2rem; }
.btn {
  border: 1px solid var(--brass-dim); background: #1a3a29; color: var(--brass-hi);
  padding: .55rem 1.1rem; border-radius: 8px; cursor: pointer; font-size: .92rem;
}
.btn:hover:not(:disabled) { border-color: var(--brass); background: #21482f; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #c99a3f, #a67c2c); color: #1d1405; border-color: #e8c46a; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #dcb152, #b8892f); }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { color: var(--ink); border-color: var(--brass-dim); }
.error { background: #3a1d18; border: 1px solid #7a3a2e; color: #f2b1a5; padding: .7rem 1rem; border-radius: 8px; margin: .8rem 0; }
.ok { background: #173a22; border: 1px solid #3f7a4e; color: #a9e6b4; padding: .7rem 1rem; border-radius: 8px; margin: .8rem 0; }
.hint { color: var(--muted); font-size: .85rem; }
.hint-inline { color: var(--muted); font-size: .8rem; font-weight: normal; }
.party-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .9rem; margin: 1rem 0; }
.party-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.party-card h3 { margin: 0 0 .6rem; font-size: 1rem; color: var(--brass-hi); }
.role-note { display: block; font-size: .78rem; color: var(--muted); font-weight: normal; }
.key-ok { font-size: .82rem; color: var(--green); font-family: ui-monospace, Menlo, monospace; word-break: break-all; }
.contract-card { background: var(--panel2); border: 1px solid var(--brass-dim); border-radius: 10px; padding: 1.2rem; margin: 1rem 0; }
.addr-row { display: flex; gap: 1.2rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.field-label { font-size: .8rem; color: var(--muted); margin-bottom: .25rem; }
.addr { font-size: 1.02rem; color: var(--brass-hi); word-break: break-all; }
#escrow-qr { background: #fff; border-radius: 8px; padding: 6px; }
.asm { display: block; background: var(--code); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; font-size: .82rem; color: #cfe3c8; word-break: break-all; white-space: pre-wrap; }
.leaf { margin: .8rem 0; }
.tag { font-size: .72rem; background: #1a3a29; border: 1px solid var(--brass-dim); color: var(--brass-hi); border-radius: 999px; padding: .1rem .55rem; vertical-align: middle; }
.kv { display: grid; gap: .5rem; margin: .6rem 0; }
.kv > div { display: grid; grid-template-columns: 170px 1fr; gap: .8rem; align-items: baseline; }
.kv dt { color: var(--muted); font-size: .85rem; }
.kv dd { margin: 0; font-size: .85rem; word-break: break-all; }
.kv dd code { font-size: .78rem; color: #cfe3c8; }
.funding { color: var(--muted); font-size: .9rem; }
.utxo-list { display: grid; gap: .5rem; margin: .8rem 0; }
.utxo { display: flex; gap: .8rem; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .9rem; cursor: pointer; font-size: .85rem; }
.utxo:hover { border-color: var(--brass-dim); }
.utxo.selected { border-color: var(--brass); background: #1a3a29; }
.utxo code { font-size: .75rem; color: #cfe3c8; }
.mode-cards, .op-cards { display: flex; gap: .8rem; flex-wrap: wrap; margin: 1rem 0; }
.mode-card, .op-card {
  flex: 1 1 220px; text-align: left; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; padding: .9rem 1.1rem; cursor: pointer; color: var(--ink);
}
.mode-card.selected, .op-card.selected { border-color: var(--brass); background: #1c3d2a; box-shadow: 0 0 0 1px var(--brass-dim); }
.op-name { display: block; font-weight: 700; color: var(--brass-hi); font-size: 1.05rem; }
.op-desc { display: block; color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.digest { font-size: .78rem; color: var(--brass-hi); word-break: break-all; }
.sig-slot { background: var(--code); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin: .8rem 0; }
.sig-slot h4 { margin-top: 0; color: var(--brass-hi); }
.sig-slot .sig-out { font-size: .75rem; color: var(--green); word-break: break-all; margin-top: .4rem; }
.lock-status { font-size: .9rem; padding: .5rem .8rem; border-radius: 8px; display: inline-block; }
.lock-status.locked { background: #3a2a12; border: 1px solid var(--brass-dim); color: var(--brass-hi); }
.lock-status.open { background: #173a22; border: 1px solid #3f7a4e; color: #a9e6b4; }
footer { max-width: 980px; margin: 0 auto; padding: 1.5rem; color: var(--muted); font-size: .85rem; text-align: center; }
footer a { color: var(--brass-hi); }
footer .donate code { font-size: .75rem; color: var(--brass-hi); word-break: break-all; }
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .kv > div { grid-template-columns: 1fr; }
  .topbar { position: static; }
}

.warnings { background: #3a2a12; border: 1px solid var(--brass-dim); color: #f2cd7e; padding: .7rem 1rem; border-radius: 8px; margin: .8rem 0; }

/* Keyboard focus: a visible ring in this app's accent on every interactive element (fleet focus-visible pass). */
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* Skip link: the first Tab stop on the page — parked off-screen until keyboard focus reveals it (fleet skip-link pass). */
.skip-link { position: absolute; left: 12px; top: -64px; z-index: 1000; padding: 10px 16px; border: 2px solid var(--brass); border-radius: 8px; background: #0b0e14; color: var(--brass); font-weight: 700; text-decoration: none; transition: top .15s ease; }
.skip-link:focus-visible { top: 12px; }
main:focus { outline: none; }

/* Reduced motion: when the OS asks for reduced motion, animations and transitions finish near-instantly and scrolling is not smoothed (fleet reduced-motion pass). Near-zero durations — not animation: none — so fade-ins still land on their end state and no content can be stranded invisible. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
