/* ==========================================================================
   TANTROOM — CLEAN MONOCHROME & ACID-NEON ENGINEERING UI
   ========================================================================== */

:root {
  --bg: #060607;
  --surface: #0d0e11;
  --surface-2: #13151a;
  --input-bg: #08090b;
  --text: #f5f6f8;
  --muted: #848996;
  --dim: #4c505c;
  --neon: #c8ff00;
  --neon-dim: rgba(200, 255, 0, 0.11);
  --neon-border: rgba(200, 255, 0, 0.38);
  --border: rgba(255, 255, 255, 0.09);
  --border-hover: rgba(255, 255, 255, 0.2);
  --danger: #ff4d6a;
  --radius: 12px;
  --radius-sm: 7px;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Fira Code", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

.neon {
  color: var(--neon);
}

.hidden {
  display: none !important;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* ==========================================================================
   TOP BAR (Ultra-clean single row, never wraps on mobile)
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 6, 7, 0.86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}

.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}

.status-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 10px var(--neon);
  flex-shrink: 0;
}

.brand-wordmark {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.16em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  border-color: var(--neon-border);
  color: var(--neon);
}

.btn-wallet {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--neon);
  color: #050505;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-wallet:hover {
  filter: brightness(1.06);
}

.btn-wallet.connected {
  background: var(--surface-2);
  color: var(--neon);
  border: 1px solid var(--neon-border);
}

.wallet-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #050505;
}

.btn-wallet.connected .wallet-dot {
  background: var(--neon);
  box-shadow: 0 0 6px var(--neon);
}

/* ==========================================================================
   MAIN SHELL & TELEMETRY STRIP
   ========================================================================== */
.shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 72px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.telemetry-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.telemetry-addr-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.t-label {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.t-addr {
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-addr:hover {
  color: var(--neon);
}

.telemetry-counters {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.t-counter {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.t-val {
  font-size: 13px;
  font-weight: 700;
}

.t-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

/* ==========================================================================
   INGRESS COMPOSER
   ========================================================================== */
.ingress-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s ease;
}

.ingress-box:focus-within {
  border-color: var(--neon-border);
}

.ingress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ingress-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--neon);
  letter-spacing: 0.08em;
}

.ingress-bytes {
  font-size: 11px;
  color: var(--muted);
}

.ingress-textarea {
  width: 100%;
  min-height: 88px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  resize: vertical;
}

.ingress-textarea:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.25);
}

.media-stage {
  background: var(--input-bg);
  border: 1px solid var(--neon-border);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.media-stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--neon);
}

.media-stage-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 6px;
  font-family: var(--mono);
  font-size: 10.5px;
}

.btn-remove {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding: 2px 6px;
}

.btn-remove:hover {
  color: var(--danger);
}

.media-stage-frame {
  display: flex;
  justify-content: center;
  background: #040405;
  border-radius: 5px;
  padding: 6px;
  max-height: 240px;
  overflow: hidden;
}

.media-stage-frame img {
  max-width: 100%;
  max-height: 225px;
  object-fit: contain;
}

.ingress-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-attach {
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-attach:hover {
  border-color: var(--neon-border);
  color: var(--neon);
}

.btn-subtle {
  height: 34px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-subtle:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.btn-stamp {
  height: 34px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  background: var(--neon);
  color: #050505;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
}

.btn-stamp:hover {
  filter: brightness(1.06);
}

.btn-stamp:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hex-drawer {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.hex-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.raw-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.raw-toggle input {
  accent-color: var(--neon);
}

.hex-to-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mono-input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11.5px;
}

.mono-input:focus {
  outline: none;
  border-color: var(--neon-border);
}

.hex-dump {
  background: #040405;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 8px;
  color: var(--neon);
  font-size: 10.5px;
  max-height: 92px;
  overflow-y: auto;
  word-break: break-all;
  white-space: pre-wrap;
}

.tx-banner {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.45;
  word-break: break-all;
}

.tx-banner.info {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-hover);
  color: var(--text);
}

.tx-banner.success {
  background: var(--neon-dim);
  border: 1px solid var(--neon-border);
  color: var(--neon);
}

.tx-banner.error {
  background: rgba(255, 77, 106, 0.1);
  border: 1px solid rgba(255, 77, 106, 0.35);
  color: #ff8da1;
}

.tx-banner a {
  color: #ffffff;
  text-decoration: underline;
}

/* ==========================================================================
   ON-CHAIN LEDGER FEED
   ========================================================================== */
.feed-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feed-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.feed-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.feed-heading {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
}

.feed-count {
  font-size: 10.5px;
  color: var(--neon);
  background: var(--neon-dim);
  border: 1px solid var(--neon-border);
  padding: 1px 7px;
  border-radius: 999px;
}

.feed-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pills {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.pill {
  height: 28px;
  padding: 0 9px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.15s ease;
}

.pill.active {
  background: var(--surface-2);
  color: var(--neon);
}

.lookup-row {
  display: flex;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.sync-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.sync-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 8px var(--neon);
  flex-shrink: 0;
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tx-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  transition: border-color 0.15s ease;
}

.tx-card:hover {
  border-color: var(--border-hover);
}

.tx-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.tx-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nonce-tag {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  color: #050505;
  background: var(--neon);
  padding: 2px 8px;
  border-radius: 5px;
}

.block-tag,
.byte-tag,
.type-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 5px;
}

.type-tag {
  color: var(--text);
}

.tx-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.tx-body {
  font-size: 14px;
  line-height: 1.58;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  max-height: 360px;
  overflow-y: auto;
}

.tx-body.code-view {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}

.tx-html-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.html-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--neon);
}

.html-iframe {
  width: 100%;
  height: 280px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.tx-media {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #040405;
  display: flex;
  justify-content: center;
}

.tx-media img {
  max-width: 100%;
  max-height: 440px;
  object-fit: contain;
  display: block;
}

.tx-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.tx-hash-link {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.tx-hash-link:hover {
  color: var(--neon);
}

.tx-foot-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  max-width: 400px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--neon-border);
  border-radius: var(--radius);
  padding: 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--neon);
  margin-bottom: 12px;
}

.modal-body p {
  font-size: 13.5px;
  margin-bottom: 10px;
}

.install-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.install-list strong {
  color: var(--text);
}

@media (max-width: 520px) {
  .telemetry-strip {
    flex-direction: column;
    align-items: flex-start;
  }
  .telemetry-counters {
    width: 100%;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }
  .t-counter {
    align-items: flex-start;
  }
}
