@font-face {
  font-family: 'Geist';
  src: url('https://musechain.io/fonts/geist/geist-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-black: #0b0c0e;
  --bg-card: #14161a;
  --bg-card-subtle: #1a1d24;
  --border: #262932;
  --border-focus: #3d4250;
  --text-main: #f3f4f6;
  --text-muted: #8e94a4;
  --lime: #ccff00;
  --lime-dim: rgba(204, 255, 0, 0.12);
  --lime-glow: rgba(204, 255, 0, 0.25);
  --red: #ff4d4f;
  --red-dim: rgba(255, 77, 79, 0.14);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  background-color: var(--bg-black);
  color: var(--text-main);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 12, 14, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-bar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge {
  background: var(--lime);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.brand .title {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.author-links {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.author-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.author-links a:hover {
  color: var(--lime);
}

.sep {
  color: var(--border);
}

/* Container */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* Hero */
.hero-block {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
  align-items: center;
  margin-bottom: 2.5rem;
  background: radial-gradient(circle at top right, rgba(204, 255, 0, 0.04), transparent 60%);
  border: 1px solid var(--border);
  padding: 2rem;
  border-radius: 12px;
}

.tag-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill-lime {
  background: var(--lime-dim);
  color: var(--lime);
  border: 1px solid var(--lime-glow);
}

.pill-neutral {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.pill-safe {
  background: rgba(46, 204, 113, 0.12);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.25);
}

.hero-block h1 {
  font-size: 2.1rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 1rem;
  font-weight: 700;
}

.lead {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.lead code {
  color: var(--text-main);
  background: var(--bg-card-subtle);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.88em;
}

.hero-art .cover-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* State controls */
.gallery-controls {
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.control-legend .label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.state-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  background: var(--bg-card-subtle);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.tab-btn.active {
  background: #000;
  color: var(--lime);
  border-color: var(--lime);
  box-shadow: 0 0 10px rgba(204, 255, 0, 0.15);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.live { background: var(--lime); box-shadow: 0 0 6px var(--lime); }
.dot.pulse { background: #3b82f6; animation: pulse 1.2s infinite ease-in-out; }
.dot.empty { background: #666; }
.dot.error { background: var(--red); }

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Viewport Canvas */
.viewport-canvas {
  background: #0e1014;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  min-height: 380px;
  position: relative;
  margin-bottom: 2.5rem;
}

.view-panel.hidden {
  display: none;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.85rem;
  margin-bottom: 1.5rem;
}

.view-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.view-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Receipt Cards Grid */
.receipt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 1.25rem;
}

.receipt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.receipt-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.receipt-card.status-success {
  border-top: 3px solid var(--lime);
}

.receipt-card.status-failed {
  border-top: 3px solid var(--red);
  background: linear-gradient(180deg, rgba(255, 77, 79, 0.03) 0%, var(--bg-card) 40%);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.2rem;
}

.app-tag {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}

.app-green { background: #1b3d2f; border: 1px solid #2ecc71; color: #a3f7bf; }
.app-purple { background: #321c42; border: 1px solid #a855f7; color: #e9d5ff; }
.app-blue { background: #162a45; border: 1px solid #3b82f6; color: #bfdbfe; }
.app-red { background: #3d1b1f; border: 1px solid #ff4d4f; color: #fca5a5; }

.app-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
}

.app-contract {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.success {
  background: var(--lime-dim);
  color: var(--lime);
  border: 1px solid var(--lime-glow);
}

.status-badge.failed {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255, 77, 79, 0.3);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.field-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.field-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field-val {
  font-size: 0.88rem;
  color: var(--text-main);
}

.method-code {
  font-family: var(--font-mono);
  background: var(--bg-card-subtle);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.82rem;
  width: fit-content;
  color: #e5e7eb;
}

.method-code.error {
  color: #ff9494;
  border-left: 2px solid var(--red);
}

.agent-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.agent-pill {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  color: var(--lime);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.agent-addr {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.time-val {
  font-size: 0.82rem;
  color: #d1d5db;
}

.block-num {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-left: 0.35rem;
}

.error-banner {
  background: var(--red-dim);
  border: 1px solid rgba(255, 77, 79, 0.25);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.err-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.err-detail {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #fca5a5;
}

.card-footer {
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
}

.gas-stamp {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.gas-stamp.warn {
  color: #ff9494;
}

.card-link {
  color: var(--lime);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s;
}

.card-link:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* Skeleton Loading State */
.skeleton-card {
  pointer-events: none;
}

.skeleton-pill, .skeleton-line {
  background: linear-gradient(90deg, #1a1d24 0%, #262a34 50%, #1a1d24 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.sk-avatar { width: 110px; height: 32px; }
.sk-status { width: 65px; height: 22px; }
.sk-wide { width: 100%; height: 18px; margin-bottom: 0.5rem; }
.sk-mid { width: 75%; height: 18px; margin-bottom: 0.5rem; }
.sk-narrow { width: 50%; height: 18px; }
.sk-tag { width: 120px; height: 14px; }

.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state-box {
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 520px;
  margin: 0 auto;
}

.empty-glyph {
  margin-bottom: 1.25rem;
}

.empty-state-box h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.empty-state-box p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.empty-state-box code {
  color: var(--text-main);
  background: var(--bg-card-subtle);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

.btn-outline {
  display: inline-block;
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn-outline:hover {
  border-color: var(--lime);
  color: var(--lime);
}

/* Spec Audit Block */
.spec-audit {
  margin-bottom: 2.5rem;
}

.audit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
}

.audit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.audit-header h3 {
  font-size: 1.1rem;
}

.badge-status {
  background: var(--lime-dim);
  color: var(--lime);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
  border: 1px solid var(--lime-glow);
}

.audit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.spec-col h4 {
  font-size: 0.9rem;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.spec-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.spec-list li {
  position: relative;
  padding-left: 1.25rem;
}

.spec-list.ok li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--lime);
  font-weight: 700;
}

.spec-list.excluded li::before {
  content: "✕";
  position: absolute;
  left: 0;
  color: var(--red);
  font-weight: 700;
}

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

/* Notes Grid */
.tech-notes {
  margin-bottom: 2rem;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.note-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.25rem;
  border-radius: 8px;
}

.note-box h5 {
  font-size: 0.9rem;
  color: var(--lime);
  margin-bottom: 0.4rem;
}

.note-box p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.note-box code {
  color: var(--text-main);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-wrap {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer code {
  font-family: var(--font-mono);
  color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
  .hero-block {
    grid-template-columns: 1fr;
  }
  .audit-grid {
    grid-template-columns: 1fr;
  }
  .brand-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}