[hidden] { display: none !important; }
:root {
  --bg: #14111d;
  --bg2: #1c1828;
  --card: #231e33;
  --line: #342d4a;
  --text: #f4f1fa;
  --muted: #a69fbd;
  --gold: #f2c14e;
  --gold2: #d9a12b;
  --green: #3ddc97;
  --red: #ff6b6b;
  --radius: 18px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.app { max-width: 480px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 18px 32px; }
.view { display: none; animation: in .18s ease-out; }
.view.active { display: block; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1 { font-size: 30px; margin: 12px 0 6px; letter-spacing: -.5px; }
h2 { font-size: 20px; margin: 0; }
h3 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.center { text-align: center; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.between { justify-content: space-between; align-items: center; }
.between > * { flex: none; }

.hero { text-align: center; padding: 48px 0 36px; }
.hero-coin { width: 112px; height: 112px; filter: drop-shadow(0 12px 30px rgba(242, 193, 78, .25)); }
.hero-coin.small { width: 72px; height: 72px; }

.bar { display: flex; align-items: center; gap: 8px; margin: 4px 0 20px; min-height: 40px; }
.back { background: none; border: 0; font-size: 34px; line-height: 1; padding: 0 10px 4px 0; color: var(--muted); }

label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input, select, textarea {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; font-size: 16px; color: var(--text); outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
textarea { resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
label.file input { padding: 10px; font-size: 14px; }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); }
label.check input { width: 20px; height: 20px; accent-color: var(--gold); }

.btn { border: 0; border-radius: 14px; padding: 15px 18px; font-weight: 600; font-size: 16px; width: 100%; }
.btn.primary { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #241a02; }
.btn.primary:disabled { opacity: .4; cursor: not-allowed; }
.btn.ghost { background: var(--card); border: 1px solid var(--line); }
.btn.danger { background: transparent; border: 1px solid var(--red); color: var(--red); }
.link { background: none; border: 0; color: var(--gold); font-weight: 600; padding: 0; }
.icon-btn { background: var(--card); border: 1px solid var(--line); border-radius: 12px; width: 42px; height: 42px; font-size: 18px; }
.icon-btn.small { width: 32px; height: 32px; font-size: 14px; border-radius: 10px; }

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.addr { background: none; border: 0; padding: 0; font-family: ui-monospace, Menlo, monospace; font-size: 15px; display: block; }
.addr::after { content: " ⧉"; color: var(--muted); }

.balance-card {
  background: radial-gradient(120% 140% at 100% 0%, #3b2f12 0%, var(--card) 55%);
  border: 1px solid #4a3d1c; border-radius: var(--radius); padding: 20px;
}
.balance { font-size: 34px; font-weight: 700; letter-spacing: -.5px; margin: 6px 0; }
.balance.small { font-size: 26px; }
.balance .unit { font-size: 16px; color: var(--muted); font-weight: 600; margin-left: 4px; }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0 26px; }
.actions button {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600;
}
.actions span {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(242, 193, 78, .12); color: var(--gold); font-size: 18px;
}

.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tx-list, .key-list { list-style: none; margin: 0; padding: 0; }
.tx-list li {
  display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.tx-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--card); flex: none; }
.tx-icon.in { color: var(--green); }
.tx-icon.out { color: var(--text); }
.tx-main { flex: 1; min-width: 0; }
.tx-main b { display: block; font-size: 15px; font-weight: 600; }
.tx-main span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-amount { font-weight: 600; white-space: nowrap; }
.tx-amount.in { color: var(--green); }
.empty { color: var(--muted); text-align: center; padding: 28px 0; border: 0 !important; cursor: default !important; display: block !important; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.confirm-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.details { margin: 14px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; font-size: 14px; text-align: left; width: 100%; }
.details dt { color: var(--muted); }
.details dd { margin: 0; word-break: break-all; text-align: right; }

.key-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.key-list .k { word-break: break-all; }
.key-list .t { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.key-list button { background: none; border: 1px solid var(--line); border-radius: 10px; color: var(--red); padding: 6px 10px; font-size: 13px; }

.alert { background: rgba(242, 193, 78, .1); border: 1px solid rgba(242, 193, 78, .35); border-radius: 14px; padding: 14px; font-size: 14px; line-height: 1.45; }
.secret { display: block; background: var(--bg2); border: 1px dashed var(--line); border-radius: 12px; padding: 14px; word-break: break-all; font-size: 14px; user-select: all; text-align: left; width: 100%; }
.secret.small { font-size: 11.5px; }

.qr { width: 260px; height: 260px; background: #fff; border-radius: 16px; padding: 10px; image-rendering: pixelated; }
.ok-badge { width: 76px; height: 76px; border-radius: 50%; background: rgba(61, 220, 151, .15); color: var(--green); display: grid; place-items: center; font-size: 40px; margin-top: 40px; }

.camera { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 1; }
.camera video { width: 100%; height: 100%; object-fit: cover; }
.camera-frame { position: absolute; inset: 18%; border: 3px solid var(--gold); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: #2d2640; border: 1px solid var(--line); padding: 12px 18px; border-radius: 14px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100% - 36px); text-align: center; z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--red); color: #ffd6d6; }
.loading { position: fixed; inset: 0; background: rgba(10, 8, 16, .55); display: grid; place-items: center; z-index: 9; }
.loading[hidden] { display: none; }
.spinner { width: 42px; height: 42px; border: 4px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
