:root {
  --bg: #050816;
  --card: #111827;
  --accent: #38bdf8;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --error: #f97373;
  --radius: 12px;
  --sticky-space: 50px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: radial-gradient(circle at top, #0f172a 0, #020617 55%, #000 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 16px;
}

.app {
  width: 100%;
  max-width: 900px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
}

/* Ensure page content has room at the bottom so the sticky button doesn't overlap it */
.app {
  padding-bottom: var(--sticky-space);
}

/* Non-overlapping GitHub link placed inline at the end of the main container */
.github-container {
  margin-top: 12px;
  text-align: right;
}

.github-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15,23,42,0.6);
}

.github-inline:hover {
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.35);
}

.github-inline .fa-github,
.github-inline .fa-brands {
  font-size: 18px;
}

/* Sticky GitHub button fixed to viewport bottom-right */
.github-sticky {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  z-index: 9999;
  font-size: 13px;
}

.github-sticky:hover {
  color: var(--accent);
}

@media (max-width: 480px) {
  /* reduce reserved space on narrow screens where the sticky button becomes icon-only */
  .app { padding-bottom: 48px; }

  /* Make the sticky button smaller and sit slightly higher to remain visible
     above mobile UI chrome; use safe-area inset for phones with home indicators */
  .github-sticky {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    padding: 6px;
    width: 40px;
    height: 40px;
    justify-content: center;
  }

  .github-sticky span {
    display: none;
  }

  .github-sticky .fa-brands {
    font-size: 14px;
  }
}

header {
  margin-bottom: 16px;
}

header h1 {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

header p {
  font-size: 0.85rem;
  color: var(--muted);
}

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

.badge {
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: var(--muted);
}

.panel {
  background: rgba(15, 23, 42, 0.9);
  border-radius: var(--radius);
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  margin-bottom: 12px;
}

.panel-title {
  font-size: 0.9rem;
  margin-bottom: 8px;
  font-weight: 600;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 0.75rem;
  color: var(--muted);
}

.field input,
.field select {
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  font-size: 0.8rem;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}

button {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: #0b1120;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.pill {
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: var(--muted);
}

.status {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

.status.error {
  color: var(--error);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.results-header h2 {
  font-size: 0.95rem;
}

.results-header span {
  font-size: 0.75rem;
  color: var(--muted);
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

.tx-card {
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.12), rgba(15, 23, 42, 0.95));
  border-radius: var(--radius);
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.tx-hash {
  font-size: 0.75rem;
  word-break: break-all;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

.tx-hash:hover {
  color: var(--text);
  text-decoration: underline;
}

.tx-meta-count {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.6);
  color: var(--accent);
}

.meta-item {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: 0.7rem;
  color: var(--muted);
}

.meta-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.meta-key {
  font-size: 0.7rem;
  color: var(--muted);
}

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.9);
  border-top: 1px solid rgba(148, 163, 184, 0.3);
  padding: 12px 16px;
  text-align: center;
  backdrop-filter: blur(16px);
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.github-link:hover {
  color: var(--accent);
}

.github-icon {
  fill: var(--text);
  transition: fill 0.2s;
}

.github-link:hover .github-icon {
  fill: var(--accent);
}

.github-sticky .fa-brands {
  font-size: 18px;
}

@media (min-width: 640px) {
  .form-row {
    flex-direction: row;
  }
  .field {
    flex: 1;
  }
}

button.loading {
  opacity: 0.7;
  pointer-events: none;
}