:root {
  --bg: #fff;
  --bg2: #eaeaea;
  --fg: #111;
  --accent: #7b3fe4;
  --muted: #666;
  --border: #bbb;
}
.dark {
  --bg: #000;
  --bg2: #111;
  --fg: #e0e0e0;
  --accent: #f59e0b;
  --muted: #666;
  --border: #333;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--bg); }
body {
  font-family: 'Fira Code', monospace, 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Twemoji Mozilla', emoji;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
}
a { color: var(--accent); text-decoration: none; }
p:last-child { margin-bottom: 0 !important; }
pre {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  padding-left: 2ch;
  text-indent: -2ch;
}
a:hover { text-decoration: underline; }
img { max-width: 100%; max-height: 80vh; object-fit: contain; }

/* Scrollbar — force classic (non-overlay) style */
::-webkit-scrollbar { width: 18px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 9px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
* { scrollbar-width: auto; scrollbar-color: var(--border) var(--bg); scrollbar-gutter: stable; }

/* Signer popover panel */
.signer-input {
  width: 100%; padding: 8px 12px;
  background: var(--bg2); color: var(--fg);
  border: 1px solid var(--border); border-radius: 4px;
  font-family: inherit; font-size: 13px;
  margin-bottom: 8px;
}
.signer-btn {
  width: 100%; padding: 8px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 4px;
  font-family: inherit; font-size: 13px;
  cursor: pointer;
  margin-top: 4px;
}
.signer-btn:hover { opacity: 0.9; }
.signer-btn-secondary {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
  margin-top: 16px;
}
.signer-btn-sm {
  padding: 4px 12px;
  background: var(--bg2); color: var(--fg);
  border: 1px solid var(--border); border-radius: 4px;
  font-family: inherit; font-size: 12px;
  cursor: pointer;
}
.signer-identity {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.signer-identity > span:last-child { display: flex; gap: 4px; }
.signer-add {
  display: flex; gap: 8px;
  margin-top: 16px;
}
.signer-add .signer-input { margin-bottom: 0; flex: 1; }
.signer-add .signer-btn { width: auto; margin-top: 0; }
.signer-sep { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.signer-msg { color: var(--accent); }
.signer-textarea {
  resize: vertical; min-height: 60px;
  font-family: monospace;
}
.signer-warn {
  color: var(--accent); font-weight: bold; font-size: 12px;
  padding: 8px; background: rgba(255,100,50,0.1);
  border-radius: 4px; border: 1px solid var(--accent);
}
.signer-mnemonic {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 6px; margin: 12px 0;
}
.signer-word {
  background: var(--bg2); padding: 6px 8px;
  border-radius: 4px; font-size: 13px;
  font-family: monospace;
}
.signer-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 16px;
}
.signer-actions .signer-btn-secondary {
  flex: 1; margin-top: 0;
}
.signer-btn-danger {
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent);
}

/* Donation confetti — one-shot, 17 pieces, pure CSS. */
.confetti {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 10000;
  display: none;
}
.confetti.run { display: block; }
.confetti i {
  position: absolute;
  top: -10px;
  width: 10px; height: 14px;
  opacity: 0;
  transform-origin: center;
}
.confetti.run i {
  animation: confetti-fall 1800ms cubic-bezier(.2,.6,.3,1) forwards;
  animation-iteration-count: 1;
}
@keyframes confetti-fall {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 1; }
}
.confetti i:nth-child(1)  { left: 8%;  background: #ff4d6d; --dx: 20px;   --dy: 98vh; --r: 540deg; animation-delay: 0ms;   clip-path: polygon(50% 0,100% 100%,0 100%); }
.confetti i:nth-child(2)  { left: 15%; background: #ffd166; --dx: -30px;  --dy: 102vh; --r: -420deg; animation-delay: 40ms;  clip-path: polygon(0 0,100% 0,100% 100%,0 100%); }
.confetti i:nth-child(3)  { left: 22%; background: #06d6a0; --dx: 10px;   --dy: 100vh; --r: 720deg; animation-delay: 120ms; clip-path: circle(50%); }
.confetti i:nth-child(4)  { left: 30%; background: #118ab2; --dx: -12px;  --dy: 104vh; --r: -300deg; animation-delay: 80ms;  clip-path: polygon(50% 0,100% 50%,50% 100%,0 50%); }
.confetti i:nth-child(5)  { left: 37%; background: #ef476f; --dx: 36px;   --dy: 99vh; --r: 480deg; animation-delay: 180ms; }
.confetti i:nth-child(6)  { left: 44%; background: #ffd166; --dx: -20px;  --dy: 106vh; --r: 600deg; animation-delay: 60ms;  clip-path: polygon(50% 0,100% 100%,0 100%); }
.confetti i:nth-child(7)  { left: 50%; background: #9b5de5; --dx: 8px;    --dy: 101vh; --r: -540deg; animation-delay: 220ms; clip-path: circle(50%); }
.confetti i:nth-child(8)  { left: 56%; background: #06d6a0; --dx: -28px;  --dy: 103vh; --r: 360deg; animation-delay: 100ms; clip-path: polygon(0 0,100% 0,100% 100%,0 100%); }
.confetti i:nth-child(9)  { left: 62%; background: #f15bb5; --dx: 16px;   --dy: 97vh; --r: 420deg; animation-delay: 160ms; clip-path: polygon(50% 0,100% 50%,50% 100%,0 50%); }
.confetti i:nth-child(10) { left: 68%; background: #118ab2; --dx: -8px;   --dy: 105vh; --r: -660deg; animation-delay: 40ms;  }
.confetti i:nth-child(11) { left: 73%; background: #ffd166; --dx: 24px;   --dy: 96vh; --r: 480deg; animation-delay: 200ms; clip-path: polygon(50% 0,100% 100%,0 100%); }
.confetti i:nth-child(12) { left: 78%; background: #ff4d6d; --dx: -18px;  --dy: 100vh; --r: -420deg; animation-delay: 140ms; clip-path: circle(50%); }
.confetti i:nth-child(13) { left: 83%; background: #06d6a0; --dx: 12px;   --dy: 104vh; --r: 600deg; animation-delay: 80ms;  }
.confetti i:nth-child(14) { left: 88%; background: #9b5de5; --dx: -30px;  --dy: 99vh; --r: -300deg; animation-delay: 260ms; clip-path: polygon(0 0,100% 0,100% 100%,0 100%); }
.confetti i:nth-child(15) { left: 5%;  background: #118ab2; --dx: 18px;   --dy: 102vh; --r: 540deg; animation-delay: 300ms; clip-path: polygon(50% 0,100% 50%,50% 100%,0 50%); }
.confetti i:nth-child(16) { left: 92%; background: #ef476f; --dx: -10px;  --dy: 106vh; --r: -480deg; animation-delay: 220ms; clip-path: polygon(50% 0,100% 100%,0 100%); }
.confetti i:nth-child(17) { left: 48%; background: #ffd166; --dx: 32px;   --dy: 95vh; --r: 720deg; animation-delay: 340ms; clip-path: circle(50%); }
