/* ============ RegistryBit — modern dark theme ============ */

:root {
  --bg: #0b0d14;
  --bg-2: #10131d;
  --card: #151927;
  --card-2: #1a1f30;
  --border: #262c40;
  --border-2: #333b55;
  --text: #e8ecf4;
  --muted: #9aa3b8;
  --faint: #6b7490;
  --accent-a: #9945ff;
  --accent-b: #14f195;
  --grad: linear-gradient(90deg, #9945ff 0%, #5f7bff 50%, #14f195 100%);
  --danger: #ff5c7a;
  --warn: #ffc857;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(153, 69, 255, .13), transparent 60%),
    radial-gradient(900px 400px at 0% 0%, rgba(20, 241, 149, .07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

.mono { font-family: var(--mono); }

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

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--grad);
  box-shadow: 0 0 18px rgba(153, 69, 255, .45);
}
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: .2px; }
.brand-name em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub { color: var(--faint); font-size: 12.5px; margin-left: 2px; padding-left: 12px; border-left: 1px solid var(--border-2); }

.topbar-controls { display: flex; align-items: center; gap: 10px; }
.net-label { color: var(--faint); font-size: 12.5px; }

.net-select, select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 13.5px;
  cursor: pointer;
}
.net-select:focus { outline: 1px solid var(--accent-a); }

.wallet-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  max-width: 300px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wallet-pill:hover { border-color: var(--accent-a); color: var(--text); }
.wallet-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.wallet-pill.connected .dot { background: var(--accent-b); box-shadow: 0 0 8px var(--accent-b); }
.wallet-pill.connected { color: var(--text); border-color: rgba(20, 241, 149, .4); }

/* ---------- tabs ---------- */
.tabs {
  display: flex; gap: 6px;
  max-width: 1020px; margin: 26px auto 0;
  padding: 0 22px;
}
.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  transition: color .15s;
  display: flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text);
  background: var(--card);
  border-color: var(--border);
  border-bottom-color: var(--card);
}
.count-badge {
  background: var(--card-2);
  border: 1px solid var(--border-2);
  color: var(--muted);
  border-radius: 999px;
  font-size: 11.5px;
  min-width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 6px;
}

/* ---------- layout ---------- */
main { max-width: 1020px; margin: 0 auto 60px; padding: 0 22px; }
.panel { display: none; padding-top: 20px; }
.panel.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card.hidden, .hidden { display: none !important; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 10px; flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.hint { color: var(--faint); font-size: 12.5px; font-weight: 400; }

label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 5px; font-weight: 600; letter-spacing: .2px; }

.field-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; margin-bottom: 6px; }
.field-grid.two { grid-template-columns: 1fr 1fr; }
.field .val { color: var(--text); font-size: 14px; word-break: break-all; }

.hash-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
}
.hash {
  font-size: 13px;
  color: var(--accent-b);
  word-break: break-all;
  flex: 1;
  text-shadow: 0 0 12px rgba(20, 241, 149, .25);
}
.hash.small { font-size: 11.5px; }

/* ---------- dropzone ---------- */
.dropzone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius);
  background: rgba(21, 25, 39, .5);
  padding: 46px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  margin-bottom: 18px;
}
.dropzone.small { padding: 26px 20px; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent-a); background: rgba(153, 69, 255, .06); outline: none; }
.dropzone.dragover {
  border-color: var(--accent-b);
  background: rgba(20, 241, 149, .08);
  transform: scale(1.005);
}
.dz-icon { font-size: 34px; margin-bottom: 8px; }
.dz-title { font-size: 16.5px; font-weight: 650; margin: 0 0 6px; }
.dz-sub { color: var(--muted); font-size: 13.5px; margin: 0 auto; max-width: 460px; }
.dz-sub strong { color: var(--accent-b); font-weight: 600; }
.dropzone.hashing { pointer-events: none; opacity: .75; }
.dropzone.hashing .dz-title::after { content: "…"; }

/* ---------- form ---------- */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
input[type="text"], textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  padding: 10px 12px;
  resize: vertical;
}
input[type="text"]:focus, textarea:focus, input.mono:focus {
  outline: none;
  border-color: var(--accent-a);
  box-shadow: 0 0 0 3px rgba(153, 69, 255, .15);
}
input::placeholder, textarea::placeholder { color: var(--faint); }

.publish-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-top: 16px; flex-wrap: wrap;
}
.bytecount { color: var(--faint); font-size: 12.5px; }
.bytecount.over { color: var(--danger); font-weight: 700; }
.fee-hint { color: var(--faint); font-size: 12.5px; margin: 10px 0 0; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--border-2);
  background: var(--card-2);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: filter .15s, border-color .15s, transform .05s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

.btn-primary {
  background: var(--grad);
  border: none;
  color: #0b0d14;
  font-weight: 700;
  padding: 12px 26px;
  box-shadow: 0 4px 22px rgba(95, 123, 255, .35);
}
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn.danger, .btn-ghost.danger { color: var(--danger); border-color: rgba(255, 92, 122, .35); }
.btn-link {
  background: none; border: none; color: var(--muted);
  font-size: 13px; cursor: pointer; padding: 0; text-decoration: underline dotted;
}
.btn-link:hover { color: var(--text); }

/* ---------- results ---------- */
.result .status-line { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 700;
  padding: 7px 14px; border-radius: 999px;
}
.badge.ok { background: rgba(20, 241, 149, .12); color: var(--accent-b); border: 1px solid rgba(20, 241, 149, .4); }
.badge.bad { background: rgba(255, 92, 122, .12); color: var(--danger); border: 1px solid rgba(255, 92, 122, .4); }
.badge.warn { background: rgba(255, 200, 87, .12); color: var(--warn); border: 1px solid rgba(255, 200, 87, .4); }
.badge.pending { background: rgba(95, 123, 255, .12); color: #8fa2ff; border: 1px solid rgba(95, 123, 255, .4); }
.spin {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(143, 162, 255, .3);
  border-top-color: #8fa2ff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.meta-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.meta-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: top;
  word-break: break-word;
}
.meta-table td:first-child { color: var(--faint); width: 160px; font-weight: 600; }
.meta-table tr:last-child td { border-bottom: none; }

.sig-box { margin-top: 12px; }
.link-ext { color: #8fa2ff; text-decoration: none; font-weight: 600; }
.link-ext:hover { text-decoration: underline; }

/* ---------- how it works ---------- */
details.how {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  color: var(--muted);
  font-size: 13.5px;
}
details.how summary { cursor: pointer; color: var(--text); font-weight: 650; }
details.how ol { margin: 10px 0 4px; padding-left: 20px; }
details.how li { margin-bottom: 8px; }

/* ---------- records ---------- */
.record {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border);
}
.record:last-child { border-bottom: none; }
.record .r-main { flex: 1; min-width: 0; }
.record .r-name { font-weight: 650; font-size: 14px; word-break: break-all; }
.record .r-sub { color: var(--faint); font-size: 12.5px; margin-top: 3px; }
.record .r-hash { color: var(--accent-b); font-size: 12px; word-break: break-all; margin-top: 4px; }
.record .r-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.empty-note { color: var(--faint); font-size: 13.5px; padding: 18px 0; text-align: center; }

/* ---------- wallet drawer ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(5, 7, 12, .7);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 80px 20px 20px;
}
.drawer {
  width: 100%; max-width: 480px;
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  padding: 20px 22px 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.drawer-head h3 { margin: 0; font-size: 17px; }

.wallet-opt {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 13px 16px;
  margin: 10px 0;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: var(--sans);
  font-size: 14px;
  transition: border-color .15s, background .15s;
}
.wallet-opt:hover { border-color: var(--accent-a); background: rgba(153, 69, 255, .07); }
.wallet-opt .wo-icon { font-size: 24px; }
.wallet-opt small { color: var(--faint); }
.wo-state { margin-left: auto; color: var(--accent-b); font-size: 12.5px; font-weight: 600; }

.wallet-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--card-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  z-index: 100;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
  max-width: min(90vw, 560px);
}
.toast.err { border-color: rgba(255, 92, 122, .5); color: #ffb3c2; }
.toast.ok { border-color: rgba(20, 241, 149, .5); }

/* ---------- sig input ---------- */
.sig-row { display: flex; gap: 10px; }
.sig-row input { flex: 1; font-size: 13px; }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--border);
  color: var(--faint);
  text-align: center;
  font-size: 13px;
  padding: 26px 20px 34px;
}
footer .fine { font-size: 12px; margin-top: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .field-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
  .publish-row { flex-direction: column-reverse; align-items: stretch; }
  .publish-row .btn-primary { width: 100%; }
  .sig-row { flex-direction: column; }
  .record { flex-direction: column; }
}
