:root {
  --bg: #070a0c;
  --bg-elev: #0e1317;
  --panel: #12181e;
  --panel-2: #182028;
  --ink: #f2f0e8;
  --muted: #8b959e;
  --mint: #7dffa4;
  --mint-dim: rgba(125, 255, 164, 0.12);
  --mint-glow: rgba(125, 255, 164, 0.35);
  --line: #243038;
  --line-bright: #33404a;
  --warn: #ffb454;
  --danger: #ff6b6b;
  --ok: #7dffa4;
  --radius: 16px;
  --radius-sm: 10px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(900px 480px at 85% -8%, #163226 0%, transparent 55%),
    radial-gradient(700px 400px at 10% 20%, #102018 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--mint); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 18px 72px;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0 22px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
}
.brand img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}
.brand-sub {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 1px;
}
.nav {
  display: flex;
  align-items: center;
  gap: 6px 16px;
  flex-wrap: wrap;
}
.nav a {
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}
.nav a:hover { color: var(--mint); }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 24px;
  align-items: stretch;
  background: linear-gradient(160deg, var(--panel) 0%, var(--bg-elev) 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px;
  box-shadow: 0 0 0 1px rgba(125,255,164,0.04), 0 24px 80px rgba(0,0,0,0.35);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 49%, rgba(125,255,164,0.04) 50%, transparent 51%),
    linear-gradient(0deg, transparent 49%, rgba(125,255,164,0.03) 50%, transparent 51%);
  background-size: 28px 28px;
  pointer-events: none;
  opacity: 0.5;
}
.hero > * { position: relative; z-index: 1; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding: 22px; }
}

.ticker {
  font-family: var(--mono);
  color: var(--mint);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ticker::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px var(--mint-glow);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

h1 {
  font-size: clamp(1.85rem, 4.2vw, 2.75rem);
  line-height: 1.08;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.lede {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 22px;
  max-width: 40ch;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--mint);
  color: #06110c;
  box-shadow: 0 0 24px var(--mint-glow);
}
.btn-primary:hover { filter: brightness(1.05); text-decoration: none; }
.btn-ghost {
  border-color: var(--line-bright);
  color: var(--ink);
  background: rgba(255,255,255,0.02);
}
.btn-ghost:hover { border-color: var(--mint); color: var(--mint); text-decoration: none; }
.btn:disabled,
.btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  filter: none;
}
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }

.mascot-card {
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.08);
}
.mascot-card img {
  width: min(300px, 100%);
  margin: 0 auto;
}
.mascot-card figcaption {
  margin-top: 10px;
  color: #445;
  font-family: var(--mono);
  font-size: 0.78rem;
}

/* Banner strip */
.banner {
  margin-top: 18px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 3 / 1;
  max-height: 180px;
  background: #0a1210;
}
.banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Sections */
section { margin-top: 36px; }
h2 {
  margin: 0 0 14px;
  font-size: 1.28rem;
  letter-spacing: -0.01em;
}
.section-lead {
  color: var(--muted);
  margin: -6px 0 16px;
  font-size: 0.95rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 760px) {
  .grid-3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card p { margin: 0; color: var(--muted); font-size: 0.94rem; }
.mono { font-family: var(--mono); font-size: 0.88rem; }
.mono p { margin: 0 0 8px; }
.mono p:last-child { margin-bottom: 0; }
code {
  font-family: var(--mono);
  color: var(--mint);
  font-size: 0.9em;
  word-break: break-all;
}

/* Desk gate panel */
.desk-panel {
  background: linear-gradient(165deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.desk-panel::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, var(--mint-dim), transparent 70%);
  pointer-events: none;
}
.desk-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}
.desk-title {
  margin: 0;
  font-size: 1.15rem;
}
.desk-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  white-space: nowrap;
}
.status-pill.connected {
  color: var(--mint);
  border-color: rgba(125,255,164,0.35);
  background: var(--mint-dim);
}
.status-pill.unlocked {
  color: #06110c;
  background: var(--mint);
  border-color: var(--mint);
}
.status-pill.locked {
  color: var(--warn);
  border-color: rgba(255,180,84,0.4);
  background: rgba(255,180,84,0.1);
}

.desk-body {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
}

.wallet-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.addr {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--mint);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--line);
}

.gate-box {
  border: 1px dashed var(--line-bright);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(0,0,0,0.2);
}
.gate-box.ok {
  border-style: solid;
  border-color: rgba(125,255,164,0.4);
  background: var(--mint-dim);
}
.gate-box.warn {
  border-color: rgba(255,180,84,0.45);
}
.gate-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.gate-msg {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 600;
}
.gate-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-family: var(--mono);
}

.balance-bar {
  margin-top: 12px;
  height: 6px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
  border: 1px solid var(--line);
}
.balance-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3d8f5c, var(--mint));
  width: 0%;
  transition: width 0.4s ease;
}

.tools-unlock {
  display: none;
  margin-top: 4px;
}
.tools-unlock.show { display: block; }

.notice {
  margin-top: 28px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px dashed var(--warn);
  color: var(--warn);
  font-size: 0.9rem;
  background: rgba(255,180,84,0.05);
}

footer {
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: space-between;
}

.err {
  color: var(--danger);
  font-size: 0.88rem;
  margin: 0;
  font-family: var(--mono);
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 8px 0 0;
}

/* Mascot: landscape art, framed */
.mascot-card img {
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: cover;
  object-position: center;
  border-radius: 12px;
}

/* ClerkDesk tools shell */
.tools-shell {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  min-height: 220px;
  overflow: hidden;
}
.tools-shell[data-locked="true"] .tools-grid {
  filter: blur(3px);
  opacity: 0.35;
  pointer-events: none;
  user-select: none;
}
.tools-lock {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 24px;
  background: rgba(7, 10, 12, 0.72);
  backdrop-filter: blur(2px);
}
.tools-shell[data-locked="true"] .tools-lock { display: flex; }
.tools-lock-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
}
.tools-lock-msg {
  margin: 0;
  color: var(--muted);
  max-width: 36ch;
  font-size: 0.95rem;
}
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
}
@media (max-width: 760px) {
  .tools-grid { grid-template-columns: 1fr; }
}
.tool-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.tool-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}
.tool-desc {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
  font-family: var(--mono);
}
.field input {
  background: var(--panel);
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
  font-size: 0.92rem;
}
.field input:focus {
  outline: none;
  border-color: rgba(125, 255, 164, 0.45);
}
.tool-out {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--mint);
  font-weight: 600;
}
.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.check-list label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--ink);
  font-size: 0.9rem;
  cursor: pointer;
}
.check-list input { margin-top: 3px; accent-color: var(--mint); }
