/* ===== BotWed design tokens =====
   palette: terminal black #0A0F0A, phosphor green #39FF14, chrome-grey #C0C0C0,
            clause white #EAF7EC, danger/close #D8503C
   type: JetBrains Mono (400/500/700), bundled local, no CDN
   radius: 10px window frame only, 0 everywhere inside the screen
   motion: one idiom - typewriter reveal + a single stamp slam, both skip
           under prefers-reduced-motion
*/

@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --black: #05070a;
  --panel: #0A0F0A;
  --green: #39FF14;
  --green-dim: #1c7a0c;
  --green-glow: rgba(57, 255, 20, 0.55);
  --chrome-1: #eef1f2;
  --chrome-2: #9aa3a6;
  --chrome-3: #4b5254;
  --clause-white: #EAF7EC;
  --danger: #D8503C;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--black);
  color: var(--green);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

.stage {
  width: 100%;
  max-width: 720px;
  padding: 20px 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* ---------- window chrome ---------- */

.window {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid #1c2620;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(57, 255, 20, 0.05);
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: linear-gradient(180deg, #14201a 0%, #0c130f 100%);
  border-bottom: 1px solid #1c2620;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.dots { display: inline-flex; gap: 6px; flex: 0 0 auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot--r { background: #d8503c; }
.dot--y { background: #d8a53c; }
.dot--g { background: #3cd86c; }

.wintitle {
  flex: 1 1 auto;
  color: #8fae95;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.winmeta {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--green-dim);
  font-size: 10px;
}
.winmeta__label { opacity: 0.7; }
.uptime { color: var(--green); font-variant-numeric: tabular-nums; }

/* ---------- screen ---------- */

.screen {
  position: relative;
  padding: 22px 18px 18px;
  min-height: 420px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(57,255,20,0.06), transparent 60%),
    #060a06;
  overflow: hidden;
}

.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(57, 255, 20, 0.05) 0px,
    rgba(57, 255, 20, 0.05) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 90px 30px rgba(0, 0, 0, 0.75);
}

.noisefield {
  position: absolute;
  inset: 0;
  padding: 68px 16px 18px;
  color: var(--green-dim);
  font-size: 10px;
  line-height: 1.7;
  letter-spacing: 0.03em;
  white-space: pre;
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

@media (max-width: 420px) {
  .noisefield { padding-top: 62px; }
}

.headerline {
  position: relative;
  z-index: 1;
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--green);
  text-shadow: 0 0 6px var(--green-glow);
  min-height: 1.5em;
}

.clausewrap {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  margin: 26px 0 20px;
  /* visible by default (no-JS / JS-failed fallback); JS hides it briefly
     via .js below to play the reveal, per the progressive-enhancement rule */
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
html.js .clausewrap { opacity: 0; transform: translateY(6px); }
html.js .clausewrap.is-visible { opacity: 1; transform: translateY(0); }

.clause {
  border: 2px solid var(--clause-white);
  padding: 12px 18px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.03em;
  color: var(--clause-white);
  background: rgba(234, 247, 236, 0.03);
  text-align: center;
  line-height: 1.5;
}
.clause__bracket { color: var(--clause-white); }
.clause__x {
  display: inline-block;
  color: #061006;
  background: var(--clause-white);
  padding: 0 3px;
  font-weight: 700;
}
.clause__text { display: block; margin-top: 2px; }

@media (min-width: 460px) {
  .clause__text { display: inline; margin-top: 0; margin-left: 6px; }
}

/* ---------- chrome MERGED stamp ---------- */

.stamp {
  position: relative;
  z-index: 3;
  margin: -6px auto 20px;
  width: max-content;
  max-width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: clamp(32px, 11vw, 54px);
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--chrome-1);
  background: linear-gradient(180deg, #ffffff 0%, #cfd4d5 22%, #8b9294 48%, #eef1f2 55%, #6a7274 70%, #d9dcdd 88%, #4b5254 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,0.6)) drop-shadow(0 10px 18px rgba(0,0,0,0.55));
  /* settled, visible by default (no-JS / JS-failed fallback) */
  transform: rotate(-7deg) scale(1);
  opacity: 1;
  transform-origin: center;
}
html.js .stamp { opacity: 0; transform: rotate(-7deg) scale(1.9); }

.stamp.is-slammed {
  animation: stampSlam 0.5s cubic-bezier(.2,1.4,.4,1) forwards;
}

@keyframes stampSlam {
  0%   { opacity: 0; transform: rotate(-7deg) scale(1.9); }
  55%  { opacity: 1; transform: rotate(-7deg) scale(0.92); }
  75%  { transform: rotate(-7deg) scale(1.04); }
  100% { opacity: 1; transform: rotate(-7deg) scale(1); }
}

.stamp__glint {
  position: absolute;
  top: -10%;
  left: -30%;
  width: 26%;
  height: 140%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.9), transparent);
  transform: skewX(-18deg);
  opacity: 0;
}
.stamp.is-slammed .stamp__glint {
  animation: stampGlint 0.9s ease 0.35s forwards;
}
@keyframes stampGlint {
  0%   { opacity: 0; left: -30%; }
  10%  { opacity: 0.9; }
  60%  { opacity: 0.2; }
  100% { opacity: 0; left: 120%; }
}

.stamp__sparkle {
  position: absolute;
  top: -6px;
  right: 6%;
  width: 14px;
  height: 14px;
  opacity: 0;
}
.stamp__sparkle::before, .stamp__sparkle::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 100%; height: 2px;
  background: #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 6px 1px #fff;
}
.stamp__sparkle::after { transform: translate(-50%, -50%) rotate(90deg); }
.stamp.is-slammed .stamp__sparkle { animation: sparkleFlash 0.6s ease 0.5s forwards; }
@keyframes sparkleFlash {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- tx / footer of terminal ---------- */

.txrow {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  /* the contract address lives here: it must be readable with no scroll and
     no click, so it stays visible by default with or without JS running */
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
  margin-bottom: 14px;
}
html.js .txrow { opacity: 0; transform: translateY(4px); }
html.js .txrow.is-visible { opacity: 1; transform: translateY(0); }

.txrow__label { color: var(--green-dim); letter-spacing: 0.05em; }

.ca {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--green);
  background: rgba(57, 255, 20, 0.08);
  border: 1px solid var(--green-dim);
  padding: 5px 9px;
  cursor: pointer;
  word-break: break-all;
  text-align: left;
  line-height: 1.4;
}
.ca:hover { background: rgba(57, 255, 20, 0.16); }
.ca:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.txrow__pair {
  color: var(--chrome-2);
  font-size: 10px;
  letter-spacing: 0.08em;
  border: 1px solid #2a332c;
  padding: 3px 6px;
}

.promptrow {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  flex-wrap: wrap;
}

.prompt { color: var(--green); }

.cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: var(--green);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.mergecount {
  margin-left: auto;
  font-size: 10px;
  color: var(--green-dim);
  letter-spacing: 0.04em;
}

/* ---------- controls / footer ---------- */

.controls {
  width: 100%;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 11px 16px;
  border: 1px solid var(--green-dim);
  background: transparent;
  color: var(--green);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--green); color: #04150a; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn[disabled] { opacity: 0.45; cursor: default; }
.btn[disabled]:hover { background: transparent; color: var(--green); }

.btn--merge { border-color: var(--clause-white); color: var(--clause-white); }
.btn--merge:hover { background: var(--clause-white); color: #0a0f0a; }

.btn--buy {
  border-color: var(--chrome-2);
  color: var(--chrome-1);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), transparent);
}
.btn--buy:hover { background: var(--chrome-1); color: #0a0f0a; }

.btn--x { padding: 11px 13px; }

.foot {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 11px;
  color: var(--green-dim);
  text-align: center;
  flex-wrap: wrap;
  justify-content: center;
}
.foot__name { color: var(--green); letter-spacing: 0.08em; }
.foot__tag { opacity: 0.8; }

/* ---------- responsive ---------- */

@media (max-width: 420px) {
  .screen { min-height: 380px; padding: 18px 12px 14px; }
  .stamp { font-size: clamp(26px, 13vw, 40px); }
  .clause { font-size: 13px; padding: 10px 12px; }
  .mergecount { margin-left: 0; }
}

@media (min-width: 920px) {
  .stage { max-width: 780px; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; opacity: 1; }
  .clausewrap, .txrow { transition: none; }
  .stamp.is-slammed { animation: none; opacity: 1; transform: rotate(-7deg) scale(1); }
  .stamp__glint, .stamp__sparkle { animation: none !important; opacity: 0 !important; }
}
