@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: #0c0d0e;
  --surface: #141618;
  --surface-raised: #1c1f23;
  --surface-border: #282c33;
  --text: #f0f2f5;
  --text-muted: #8a929d;
  --accent: #ccff00;
  --accent-dim: rgba(204, 255, 0, 0.12);
  --accent-hover: #b8e600;
  --danger: #ff4d4d;
  --danger-dim: rgba(255, 77, 77, 0.12);
  --success: #00e676;
  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.office-pill {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-radius: 4px;
  color: var(--accent);
}

.dapp-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  background: rgba(204, 255, 0, 0.08);
  color: var(--accent);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(204, 255, 0, 0.25);
  font-family: var(--mono);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent);
  animation: pulse 2s infinite;
}

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

.nav-links {
  display: flex;
  gap: 0.75rem;
  font-size: 0.82rem;
}

.muse-tag, .office-tag {
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--surface-border);
  background: var(--surface-raised);
  transition: all 0.15s ease;
}

.muse-tag:hover, .office-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Layout */
.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 1.75rem;
  width: 100%;
}

/* Hero */
.hero-card {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 2rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.kicker {
  font-size: 0.72rem;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.hero-card h1 {
  font-size: 1.85rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.lede {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 1.25rem;
}

.rule-banner {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--accent);
  padding: 0.85rem 1rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  color: var(--text);
}

.rule-banner code {
  background: var(--surface-raised);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: var(--mono);
  color: var(--accent);
}

.hero-visual {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  background: #000;
}

.hero-img {
  width: 100%;
  height: 210px;
  object-fit: cover;
  display: block;
}

.hero-meta {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(12, 13, 14, 0.85);
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--text-muted);
  border-top: 1px solid var(--surface-border);
}

/* User Identity & Contribution Meter */
.identity-section {
  margin-bottom: 1.5rem;
}

.identity-card {
  display: grid;
  grid-template-columns: auto 1fr 1.3fr auto;
  gap: 1.5rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}

.avatar-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--accent);
}

.identity-details {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.identity-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.badge {
  font-size: 0.72rem;
  font-family: var(--mono);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
}

.identity-details h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

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

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

.contribution-meter {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-ready {
  color: var(--accent);
}

.status-exhausted {
  color: var(--danger);
}

.meter-bar {
  width: 100%;
  height: 8px;
  background: var(--surface-raised);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
}

.meter-fill-ready {
  width: 100%;
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(204, 255, 0, 0.4);
  transition: width 0.3s ease, background 0.3s ease;
}

.meter-fill-exhausted {
  width: 0%;
  height: 100%;
  background: var(--danger);
}

.meter-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-ghost {
  background: transparent;
  border: 1px dashed var(--surface-border);
  color: var(--text-muted);
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s ease;
}

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

/* Workspace Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.canvas-panel {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 1.5rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.panel-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.dot.taken { background: #3c424c; }
.dot.available { background: #1a1e24; border: 1px dashed #3a424e; }
.dot.active { background: var(--accent); }

/* Canvas Matrix */
.canvas-wrapper {
  background: #090a0b;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
  display: flex;
  justify-content: center;
}

.canvas-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  width: 100%;
  max-width: 580px;
  aspect-ratio: 1 / 1;
}

.cell {
  background: #14171b;
  border: 1px solid #222730;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s ease, border-color 0.15s ease;
  aspect-ratio: 1 / 1;
}

.cell:hover {
  transform: scale(1.1);
  z-index: 10;
  border-color: #fff;
}

.cell.unclaimed {
  background: #16191f;
  border-style: dashed;
}

.cell.claimed {
  border-style: solid;
}

.cell.selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  z-index: 20;
  transform: scale(1.12);
}

.cell.user-claimed {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.grid-stats {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-muted);
  border-top: 1px solid var(--surface-border);
  padding-top: 0.85rem;
}

/* Sidebar & Actions */
.action-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 1.25rem;
}

.inspector-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.inspector-state {
  min-height: 180px;
  display: flex;
  flex-direction: column;
}

#inspector-empty {
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1.5rem;
}

.empty-compass {
  font-size: 2.2rem;
  color: var(--surface-border);
  margin-bottom: 0.5rem;
}

.cell-head-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.cell-preview-swatch {
  height: 48px;
  border-radius: 6px;
  border: 1px solid var(--surface-border);
  margin-bottom: 0.85rem;
}

.provenance-box {
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 0.8rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.prov-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.prov-label {
  color: var(--text-muted);
}

.field-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.palette-options {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.palette-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.palette-btn:hover {
  transform: scale(1.1);
}

.palette-btn.active {
  border-color: #ffffff;
  transform: scale(1.12);
}

.input-text {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  margin-bottom: 0.85rem;
}

.input-text:focus {
  outline: none;
  border-color: var(--accent);
}

.notice-pill {
  font-size: 0.75rem;
  color: #ffca28;
  background: rgba(255, 202, 40, 0.08);
  border: 1px solid rgba(255, 202, 40, 0.2);
  padding: 0.45rem 0.65rem;
  border-radius: 5px;
  margin-bottom: 1rem;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #000;
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--surface-border);
  color: var(--text-muted);
}

/* Callout Alerts */
.callout {
  padding: 1rem 1.15rem;
  border-radius: 8px;
  font-size: 0.85rem;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.callout-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.callout.success {
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid rgba(0, 230, 118, 0.25);
  color: #a7f3d0;
}

.callout.error {
  background: rgba(255, 77, 77, 0.08);
  border: 1px solid rgba(255, 77, 77, 0.25);
  color: #fca5a5;
}

.tiny-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  word-break: break-all;
}

/* Specs */
.spec-card h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

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

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

/* Footer */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--surface-border);
  padding: 1.25rem 2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-left, .footer-right {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.brand-link {
  color: var(--accent);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .hero-card {
    grid-template-columns: 1fr;
  }
  .identity-card {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}