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

:root {
  --bg: #080b0f;
  --bg2: #0d1117;
  --surface: #111820;
  --surface2: #172030;
  --surface3: #1c2840;
  --border: rgba(255,255,255,0.06);
  --border2: rgba(255,255,255,0.12);
  --text: #e8edf5;
  --text-dim: #8892a4;
  --text-muted: #4a5568;
  --cyan: #00e5ff;
  --cyan-dim: rgba(0,229,255,0.08);
  --cyan-border: rgba(0,229,255,0.2);
  --green: #00ff88;
  --green-dim: rgba(0,255,136,0.07);
  --green-border: rgba(0,255,136,0.2);
  --amber: #ffc147;
  --amber-dim: rgba(255,193,71,0.08);
  --purple: #a78bfa;
  --purple-dim: rgba(167,139,250,0.08);
  --pink: #f472b6;
  --pink-dim: rgba(244,114,182,0.08);
  --mono: 'Space Mono', monospace;
  --sans: 'Outfit', sans-serif;
  --r: 8px;
  --r2: 12px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  padding: 2rem 1rem 5rem;
  line-height: 1.5;
}

/* Grid background pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,229,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,0.015) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.wrap {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ── Header ── */
.header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--cyan-dim);
  border: 1px solid var(--cyan-border);
  border-radius: 100px;
  padding: 4px 12px 4px 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--cyan);
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.logo-dot {
  width: 6px; height: 6px;
  background: var(--cyan);
  border-radius: 50%;
  animation: blink 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

h1 {
  font-size: clamp(24px, 5vw, 38px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text);
}

h1 em {
  font-style: normal;
  color: var(--cyan);
}

.sub {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.badge-pill {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 9px;
  white-space: nowrap;
}

/* ── Controls ── */
.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  align-items: center;
}

.ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 7px 12px;
}

.ctrl label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  white-space: nowrap;
  user-select: none;
}

.ctrl select {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0;
  -webkit-appearance: none;
}

.ctrl select option { background: #111820; }

/* ── Main Token Card ── */
.main-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s;
}

.main-card.flash-anim { border-color: var(--cyan-border); }

.main-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 10%, var(--cyan) 50%, transparent 90%);
  opacity: 0;
  transition: opacity 0.4s;
}

.main-card.flash-anim::after { opacity: 1; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.ent-badge {
  background: var(--cyan-dim);
  border: 1px solid var(--cyan-border);
  border-radius: 4px;
  padding: 2px 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--cyan);
}

.token-box {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  min-height: 50px;
  word-break: break-all;
  line-height: 1.7;
  cursor: pointer;
  user-select: all;
  transition: border-color 0.15s, background 0.3s;
}

.token-box:hover { border-color: var(--border2); }

@keyframes tokenflash {
  0%   { background: rgba(0,229,255,0.08); }
  100% { background: var(--bg2); }
}

.token-box.new { animation: tokenflash 0.5s ease; }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.stats {
  display: flex;
  gap: 14px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* ── Strength Bar ── */
.strength-bar {
  display: flex;
  gap: 3px;
  margin-top: 10px;
}

.strength-seg {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--surface3);
  transition: background 0.3s;
}

/* ── Buttons ── */
.btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: var(--r);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  outline: none;
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
  color: var(--text);
}

.btn:active { transform: scale(0.97); }
.btn:focus-visible { box-shadow: 0 0 0 2px var(--cyan); }

.btn-primary {
  background: var(--cyan);
  color: #080b0f;
  border-color: var(--cyan);
  font-weight: 600;
}

.btn-primary:hover { filter: brightness(1.1); }

.btn-solid {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}

.btn-solid:hover { background: var(--surface3); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
}

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

.btn-sm {
  font-family: var(--mono);
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all 0.15s;
  outline: none;
  flex-shrink: 0;
}

.btn-sm:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn-sm:active { transform: scale(0.96); }
.btn-sm.ok, .btn.ok {
  color: var(--green);
  border-color: var(--green-border);
  background: var(--green-dim);
}

/* ── Actions Row ── */
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

/* ── Section Label ── */
.section-lbl {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-lbl::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Derived Grid ── */
.derived-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

@media (max-width: 560px) { .derived-grid { grid-template-columns: 1fr; } }

.d-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  transition: border-color 0.15s;
}

.d-card:hover { border-color: var(--border2); }

.d-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.d-lbl {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
}

.tag {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.t-cyan   { background: var(--cyan-dim);   color: var(--cyan);   border: 1px solid var(--cyan-border); }
.t-green  { background: var(--green-dim);  color: var(--green);  border: 1px solid var(--green-border); }
.t-amber  { background: var(--amber-dim);  color: var(--amber);  border: 1px solid rgba(255,193,71,.2); }
.t-purple { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(167,139,250,.2); }
.t-pink   { background: var(--pink-dim);   color: var(--pink);   border: 1px solid rgba(244,114,182,.2); }

.d-val {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  word-break: break-all;
  line-height: 1.65;
  user-select: all;
}

/* ── ENV Card ── */
.env-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 2rem;
  transition: border-color 0.15s;
}

.env-card:hover { border-color: var(--border2); }

.env-val {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  white-space: pre;
  overflow-x: auto;
  line-height: 1.85;
  user-select: all;
  padding-bottom: 4px;
}

.env-val::-webkit-scrollbar { height: 3px; }
.env-val::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 2px; }

/* ── Batch ── */
.batch-list { display: flex; flex-direction: column; gap: 7px; }

.batch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 9px 12px;
  transition: border-color 0.15s;
  animation: fadeup 0.2s ease both;
}

.batch-item:hover { border-color: var(--border2); }

@keyframes fadeup { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:none} }

.batch-n {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  min-width: 22px;
  text-align: right;
}

.batch-v {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  flex: 1;
  word-break: break-all;
  user-select: all;
}

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 1.75rem 0; }

/* ── Footer ── */
.footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer p {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
}

.shield {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid var(--green-border);
  border-radius: 4px;
  padding: 3px 10px;
}

/* ── Copyright Footer ── */
.copyright-footer {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 2rem 0 1rem;
  pointer-events: none;
}

.copyright-inner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 22px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--cyan-border);
  box-shadow: 0 0 20px rgba(0,229,255,0.05);
}

.footer-crown {
  font-size: 14px;
  display: inline-block;
  animation: crownBob 2.4s ease-in-out infinite;
}

.footer-crown:last-child { animation-delay: 1.2s; }

.footer-text {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: linear-gradient(90deg, var(--cyan), var(--green), var(--cyan), var(--green));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

@keyframes crownBob {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50%       { transform: translateY(-3px) rotate(5deg); }
}

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

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 10px 20px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--green);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 1000;
}

#toast.show { opacity: 1; transform: none; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .controls { gap: 6px; }
  h1 { font-size: 26px; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }
