/* ===== ORIGAMI WALLET — STYLES V2 ===== */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --bg: #080c10;
  --surface: #0d1117;
  --card: #0f1620;
  --border: rgba(255, 255, 255, 0.07);
  --border-accent: rgba(247, 201, 72, 0.25);
  --text: #e8f0ff;
  --muted: #6b7a99;
  --accent: #f7c948;
  --accent-dim: rgba(247, 201, 72, 0.10);
  --ok: #3ddc97;
  --ok-dim: rgba(61, 220, 151, 0.10);
  --danger: #ff5c5e;
  --danger-dim: rgba(255, 92, 94, 0.10);
  --warning: #ffaa33;
  --radius: 16px;
  --radius-sm: 10px;
  --mono: 'Space Mono', ui-monospace, monospace;
  --sans: 'Syne', ui-sans-serif, system-ui, sans-serif;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 900px 600px at 15% -5%, rgba(247,201,72,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 700px 500px at 90% 20%, rgba(61,220,151,0.04) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

/* ══ OFFLINE BANNER ══ */
#offlineBanner {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.3px;
  transition: all 0.35s;
}
#offlineBanner.online {
  background: rgba(255,92,94,0.13);
  border-bottom: 1px solid rgba(255,92,94,0.3);
  color: #ff8a8b;
}
#offlineBanner.offline {
  background: rgba(61,220,151,0.07);
  border-bottom: 1px solid rgba(61,220,151,0.18);
  color: var(--ok);
}
#offlineBanner.hidden { display: none; }

/* ══ TOPBAR ══ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(8,12,16,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.brand { display: flex; align-items: center; gap: 13px; }
.logo {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(247,201,72,0.18), rgba(247,201,72,0.03));
  border: 1px solid var(--border-accent);
  font-size: 20px;
}
.brand-text .title { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; }
.brand-text .subtitle { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-top: 1px; }

.pill {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(13,17,23,0.8);
  font-size: 11px;
  font-family: var(--mono);
  max-width: 240px;
}
.dot {
  width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
  background: var(--ok);
  box-shadow: 0 0 10px rgba(61,220,151,0.7);
  transition: all 0.3s;
}

/* ══ STEPS TRACK ══ */
.steps-track {
  display: flex; align-items: center;
  padding: 18px 24px 0;
  max-width: 1100px;
  margin: 0 auto;
  position: relative; z-index: 1;
}
.step-item { display: flex; align-items: center; gap: 9px; flex: 1; }
.step-item:last-child { flex: 0; }
.step-num {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: 12px;
  border: 2px solid var(--border);
  color: var(--muted);
  background: var(--surface);
  flex-shrink: 0;
}
.step-label { font-size: 11px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.step-line { flex: 1; height: 1px; background: var(--border); margin: 0 6px; }

/* ══ MAIN WRAP ══ */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px 40px;
  display: flex; flex-direction: column; gap: 14px;
  position: relative; z-index: 1;
}

/* ══ CARDS ══ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  animation: fadeUp 0.4s ease both;
}
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
}
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.12s; }
.card:nth-child(3) { animation-delay: 0.19s; }

.card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.card-step {
  width: 24px; height: 24px;
  border-radius: 7px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  color: var(--accent);
  font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.card-header h2 { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }

/* ══ FORM ══ */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 5px 0; }

label {
  font-size: 10px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.9px;
}

input, select, textarea {
  background: rgba(0,0,0,0.28);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-family: var(--sans); font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(247,201,72,0.4);
  box-shadow: 0 0 0 3px rgba(247,201,72,0.05);
}
select {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7a99' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}
textarea { resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.55; }
.hint { font-size: 11px; color: var(--muted); line-height: 1.4; font-family: var(--mono); }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ══ BUTTONS ══ */
.btn {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  cursor: pointer;
  font-family: var(--sans); font-weight: 700; font-size: 12px;
  letter-spacing: 0.2px;
  transition: all 0.15s;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.13); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: var(--accent-dim);
  border-color: var(--border-accent);
  color: var(--accent);
}
.btn.primary:hover { background: rgba(247,201,72,0.17); box-shadow: 0 4px 20px rgba(247,201,72,0.10); }
.btn.danger { background: var(--danger-dim); border-color: rgba(255,92,94,0.28); color: var(--danger); }
.btn.danger:hover { background: rgba(255,92,94,0.17); }
.btn.ok { background: var(--ok-dim); border-color: rgba(61,220,151,0.28); color: var(--ok); }

/* ══ MNEMONIC + MASK ══ */
.mnemonic-wrap { position: relative; }
.mnemonic-wrap textarea { padding-right: 50px; }
.btn-mask {
  position: absolute; right: 9px; top: 9px;
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.35);
  color: var(--muted);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 14px; transition: all 0.2s; padding: 0;
}
.btn-mask:hover { border-color: rgba(255,255,255,0.18); color: var(--text); }
.masked textarea { color: transparent !important; text-shadow: 0 0 8px rgba(247,201,72,0.45); }

/* Word count */
.field-footer { display: flex; align-items: center; justify-content: space-between; }
.word-count {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
  color: var(--muted);
  transition: all 0.2s;
}
.word-count.ok { color: var(--ok); border-color: rgba(61,220,151,0.28); background: var(--ok-dim); }
.word-count.warn { color: var(--warning); border-color: rgba(255,170,51,0.28); background: rgba(255,170,51,0.08); }

/* ══ PRINT AREA ══ */
.printArea {
  margin-top: 14px;
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(0,0,0,0.12);
}

.paper {
  background: #ffffff; color: #0f172a;
  border-radius: 10px; padding: 18px;
  max-width: 820px; margin: 0 auto;
  font-family: 'Space Mono', monospace;
}
.paperHead {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; border-bottom: 2px solid #e2e8f0;
  padding-bottom: 12px; margin-bottom: 14px;
}
.paperHeadLeft { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.paperTitle { font-weight: 900; font-size: 14px; font-family: var(--sans); color: #0f172a; }
.paperMeta { font-size: 10px; color: #64748b; font-family: 'Space Mono', monospace; }
.paperZpub {
  font-size: 9px; color: #475569;
  font-family: 'Space Mono', monospace;
  word-break: break-all;
  margin-top: 4px;
  line-height: 1.4;
}

.qr-box {
  flex-shrink: 0; display: flex; flex-direction: column;
  align-items: center; gap: 4px;
}
.qr-label { font-size: 9px; color: #94a3b8; font-family: 'Space Mono', monospace; text-align: center; }
.qr-canvas-wrap {
  width: 72px; height: 72px;
  border-radius: 8px; border: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: center;
  background: #f8fafc; overflow: hidden;
  font-size: 9px; color: #94a3b8;
}
.qr-canvas-wrap canvas { width: 72px !important; height: 72px !important; }

.grid { display: grid; gap: 6px; }
.cell {
  border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 6px 10px; min-height: 40px;
  display: flex; align-items: center; gap: 8px;
  background: #fafafa;
}
.num {
  width: 24px; height: 24px; border-radius: 7px;
  background: #0f172a; color: #fff;
  font-weight: 800; display: grid; place-items: center;
  font-size: 10px; flex: 0 0 auto; font-family: var(--sans);
}
.word {
  font-family: 'Space Mono', monospace; font-size: 13px;
  letter-spacing: 0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #1e293b;
}

.paperFoot {
  margin-top: 12px; border-top: 2px solid #e2e8f0; padding-top: 10px;
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 10px; color: #64748b; flex-wrap: wrap;
  font-family: 'Space Mono', monospace;
}

/* ══ DERIVATION ══ */
.addrGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.addrHead {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--muted); margin-bottom: 7px;
  display: flex; align-items: center; gap: 6px;
}
.addrHead::before {
  content: ''; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
pre.mono {
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; margin: 0;
  font-family: var(--mono); font-size: 11px;
  line-height: 1.65; overflow: auto; max-height: 240px;
  color: var(--text);
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
pre.mono::-webkit-scrollbar { width: 4px; }
pre.mono::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ══ TEXT-MODE WARNING ══ */
.warningBox {
  border: 1px solid var(--danger);
  background: var(--danger-dim);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
}

/* ══ TEXT-MODE MODAL ══ */
.modalOverlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(3px);
}
.modalBox {
  max-width: 520px; width: 100%;
  background: var(--card);
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 0 0 4px var(--danger-dim), var(--shadow);
  animation: modalPulse 1.6s ease-in-out infinite;
}
@keyframes modalPulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--danger-dim), var(--shadow); }
  50% { box-shadow: 0 0 0 8px rgba(255,92,94,.28), var(--shadow); }
}
.modalIcon { font-size: 34px; text-align: center; margin-bottom: 6px; }
.modalTitle { margin: 0 0 12px; text-align: center; color: var(--danger); font-family: var(--sans); letter-spacing: .3px; }
.modalText { font-size: 13px; line-height: 1.55; color: var(--text); margin: 0 0 10px; }
.modalCheck {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px; color: var(--text);
  margin: 12px 0 4px; cursor: pointer;
}
.modalCheck input { margin-top: 3px; }

/* ══ FOOTER ══ */
.footer {
  color: var(--muted); font-size: 11px; font-family: var(--mono);
  padding: 2px 2px 20px;
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}

/* ══ DIVIDER ══ */
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* ══ RANGE ══ */
input[type="range"] {
  padding: 4px 0; height: 28px; border: none;
  background: transparent; cursor: pointer;
}
input[type="range"]:focus { box-shadow: none; border: none; }

/* ══ RESPONSIVE ══ */
@media (max-width: 820px) {
  .grid2, .addrGrid { grid-template-columns: 1fr; }
  .wrap { padding: 14px 16px; }
  .topbar { padding: 12px 16px; }
  .steps-track { display: none; }
}

/* ══ PRINT ══ */
@media print {
  #offlineBanner, .topbar, .steps-track, .footer,
  .card:not(.card-print) { display: none !important; }
  body { background: #fff; }
  body::before { display: none; }
  .wrap { padding: 0; max-width: none; }
  .card-print { box-shadow: none; border: none; padding: 0; background: transparent; }
  .printArea { border: none; padding: 0; background: transparent; }
  .paper { border-radius: 0; max-width: none; }
}

/* ══ ANIMATIONS ══ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
