:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1c1c1c;
  --border: #2a2a2a;
  --text: #f0f0f0;
  --muted: #888888;
  --red: #e74c3c;
  --blue: #3498db;
  --green: #2ecc71;
  --orange: #f39c12;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  letter-spacing: 0;
}

button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: border-color 160ms ease, background 160ms ease, opacity 160ms ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid var(--text);
  background: linear-gradient(135deg, var(--red) 0 50%, var(--blue) 50% 100%);
  color: #0a0a0a;
  font: 800 15px var(--mono);
}

.brand-title,
h1,
h2 {
  font-weight: 800;
}

.brand-title,
.brand-subtitle {
  display: block;
}

.brand-subtitle,
.eyebrow,
.stat > span,
.readout > span,
.ledger span,
.params span,
.cost-box > span {
  color: var(--muted);
}

.brand-subtitle {
  margin-top: 2px;
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view-toggle,
.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.view-toggle button,
.segmented button {
  min-width: 76px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.view-toggle button.selected,
.segmented button.selected {
  background: var(--red);
  color: #fff;
}

.chain-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font: 500 13px var(--mono);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
}

.wallet-button,
.primary-button,
.secondary-button {
  min-height: 40px;
  padding: 0 16px;
  font-weight: 700;
}

.wallet-button,
.primary-button {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.secondary-button {
  border-color: var(--blue);
  background: transparent;
  color: var(--blue);
}

main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 42px 0 70px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  min-height: 310px;
  padding: 56px 0 34px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font: 700 12px var(--mono);
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 18px;
  font-size: clamp(44px, 7vw, 92px);
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.lede {
  max-width: 670px;
  margin-bottom: 0;
  color: #cfcfcf;
  font-size: 18px;
  line-height: 1.6;
}

.hero-status {
  display: grid;
  justify-items: end;
  gap: 16px;
}

.state-badge {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--orange);
  font: 700 13px var(--mono);
}

.state-badge.active,
.state-badge.succeeded { color: var(--green); }
.state-badge.failed { color: var(--red); }

.timer {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-family: var(--mono);
}

.timer span {
  min-width: 36px;
  font-size: 28px;
  transition: opacity 100ms ease;
}

.timer small {
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  padding-top: 22px;
}

.main-stack,
.side-stack {
  display: grid;
  gap: 20px;
  align-content: start;
}

.side-stack {
  position: sticky;
  top: 94px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 22px;
}

.section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.mono,
.stat strong,
.readout strong,
.ledger strong,
.params strong,
.cost-box strong {
  font-family: var(--mono);
}

.progress-wrap {
  display: grid;
  gap: 20px;
  margin-bottom: 22px;
}

.progress-bar {
  height: 22px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #070707;
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--blue));
  transition: width 300ms ease;
}

.dot-grid {
  display: none;
  grid-template-columns: repeat(25, 1fr);
  gap: 5px;
}

.dot-grid span {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  background: #090909;
}

.dot-grid span.filled {
  border-color: var(--red);
  background: var(--red);
}

.ring {
  display: none;
  width: 210px;
  justify-self: center;
}

.ring circle {
  fill: none;
  stroke: var(--border);
  stroke-width: 12;
}

.ring #ringProgress {
  stroke: var(--green);
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 300ms ease;
}

.ring text {
  fill: var(--text);
  font: 700 18px var(--mono);
  text-anchor: middle;
}

.stats-grid,
.action-grid,
.params {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat,
.readout,
.params div,
.ledger div,
.token-row,
.contract-row,
.cost-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #101010;
  padding: 14px;
}

.stat > span,
.readout > span,
.params span,
.ledger span,
.cost-box > span {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
}

.stat strong {
  font-size: 24px;
}

.mint-controls {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.cost-box {
  flex: 1;
  min-width: 180px;
}

.button-row {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}

.button-row button {
  flex: 1;
}

.warning {
  margin: 12px 0 0;
  color: var(--orange);
  font: 500 13px var(--mono);
}

.tx-status {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--muted);
  font: 500 13px var(--mono);
}

.ledger,
.contract-list,
.token-list {
  display: grid;
  gap: 10px;
}

.ledger div,
.params div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.token-row,
.contract-row {
  display: grid;
  gap: 10px;
}

.contract-row {
  grid-template-columns: 82px minmax(0, 1fr) auto auto;
  align-items: center;
}

.address {
  overflow: hidden;
  color: #d8d8d8;
  font: 500 12px var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-button,
.link-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.link-button {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--blue);
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.flash {
  animation: flash 500ms ease;
}

body.view-dashboard .hero-panel {
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 0.4fr);
  min-height: 220px;
}

body.view-dashboard h1 {
  font-size: clamp(36px, 5vw, 64px);
}

body.view-dashboard .dashboard-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 0.55fr);
}

body.view-dashboard .dot-grid {
  display: grid;
}

body.view-dashboard .progress-bar,
body.view-dashboard .ring {
  display: none;
}

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

body.view-terminal .brand-mark {
  background: #0f0f0f;
  color: var(--green);
  border-color: var(--green);
}

body.view-terminal .hero-panel {
  min-height: auto;
  padding-top: 28px;
}

body.view-terminal h1 {
  font-family: var(--mono);
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1.1;
}

body.view-terminal .panel {
  background: #080808;
  border-color: #21452f;
}

body.view-terminal .progress-bar,
body.view-terminal .dot-grid {
  display: none;
}

body.view-terminal .ring {
  display: block;
}

body.view-terminal .stats-grid {
  grid-template-columns: 1fr;
}

body.view-terminal .stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border-color: #21452f;
  background: #080808;
  padding: 12px 14px;
}

body.view-terminal .stat > span {
  margin-bottom: 0;
  color: var(--green);
}

body.view-terminal .stat strong {
  font-size: 18px;
}

body.view-terminal .state-badge,
body.view-terminal .eyebrow,
body.view-terminal .link-button,
body.view-terminal .secondary-button {
  color: var(--green);
}

body.view-terminal .view-toggle button.selected,
body.view-terminal .segmented button.selected,
body.view-terminal .primary-button,
body.view-terminal .wallet-button {
  background: var(--green);
  border-color: var(--green);
  color: #061006;
}

@keyframes flash {
  0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.8); }
  100% { box-shadow: 0 0 0 18px rgba(46, 204, 113, 0); }
}

@media (max-width: 900px) {
  .site-header,
  .hero-panel,
  .dashboard-grid,
  body.view-dashboard .hero-panel,
  body.view-dashboard .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .site-header {
    display: grid;
    padding: 14px 16px;
  }

  .header-actions {
    justify-content: start;
  }

  .side-stack {
    position: static;
  }

  .hero-status {
    justify-items: start;
  }

  .stats-grid,
  .action-grid,
  .params {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  main {
    width: min(100% - 24px, 1180px);
    padding-top: 24px;
  }

  h1 {
    font-size: 42px;
  }

  .view-toggle,
  .segmented,
  .mint-controls,
  .button-row {
    width: 100%;
  }

  .view-toggle button,
  .segmented button,
  .mint-controls > *,
  .button-row button {
    flex: 1;
    min-width: 0;
  }

  .mint-controls,
  .button-row {
    flex-wrap: wrap;
  }

  .contract-row {
    grid-template-columns: 1fr auto auto;
  }

  .contract-row span:first-child {
    grid-column: 1 / -1;
  }
}
