:root {
  --bg0: #0c1014;
  --bg1: #141a21;
  --bg2: #1a222c;
  --line: #2a3440;
  --text: #eef2f6;
  --muted: #8b97a8;
  --mint: #1ec9a2;
  --mint-dim: rgba(30, 201, 162, 0.14);
  --red: #f04555;
  --red-dim: rgba(240, 69, 85, 0.14);
  --amber: #e8b84a;
  --amber-dim: rgba(232, 184, 74, 0.16);
  --font: "Outfit", sans-serif;
  --mono: "JetBrains Mono", monospace;
  --radius: 14px;
  --pad: clamp(16px, 3vw, 28px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(30, 201, 162, 0.12), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(240, 69, 85, 0.1), transparent 50%),
    linear-gradient(180deg, #10151b 0%, var(--bg0) 40%, #0a0d11 100%);
}

.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--pad);
  padding-bottom: 40px;
  animation: rise 0.45s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* —— Top —— */
.top {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 16px 24px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: #06241c;
  background: linear-gradient(145deg, #2aefc0, var(--mint));
}

.brand h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.brand p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.live-strip {
  display: flex;
  gap: 8px;
}

.stat {
  min-width: 96px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(20, 26, 33, 0.85);
  border: 1px solid var(--line);
}

.stat span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat strong {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
}

.stat strong.bad { color: var(--red); }
.stat strong.good { color: var(--mint); }

.chart-link {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg1);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.chart-link:hover {
  border-color: #3d4b5c;
  background: var(--bg2);
}

/* —— Stage / primary actions —— */
.stage {
  margin-bottom: 22px;
  animation: rise 0.5s ease 0.06s both;
}

.token-bar {
  display: flex;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.grow { flex: 1; }

.field span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.move-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(20, 26, 33, 0.72);
  border: 1px solid var(--line);
}

.move-controls .chaos-toggle {
  grid-column: 1 / -1;
}

.chaos-range {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  padding-top: 4px;
}

.chaos-hint {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.range.compact {
  gap: 6px;
}

.chaos-toggle .switch-ui {
  background: #3a3020;
}

.chaos-toggle input:checked + .switch-ui {
  background: var(--amber);
}

.chaos-toggle input:checked + .switch-ui::after {
  background: #2a1c00;
}

.move-controls input[type="range"] {
  accent-color: var(--amber);
}

.move-controls .range:first-child input[type="range"] {
  accent-color: var(--mint);
}

.move-controls .range:nth-child(2) input[type="range"] {
  accent-color: var(--red);
}

.act {
  border: 0;
  border-radius: var(--radius);
  padding: 22px 14px;
  font: inherit;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.act:hover { filter: brightness(1.06); transform: translateY(-2px); }
.act:active { transform: translateY(1px) scale(0.98); }

.act-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  opacity: 0.55;
}

.act.pump { background: var(--mint); color: #04241c; }
.act.dump { background: var(--red); color: #2a060a; }
.act.chaos { background: var(--amber); color: #2a1c00; }

.act.auto {
  grid-column: 1 / -1;
  flex-direction: row;
  justify-content: center;
  gap: 12px;
  padding: 18px;
  background: var(--bg1);
  color: var(--text);
  border: 1px solid var(--line);
}

.act.auto .auto-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.act.auto.on {
  background: linear-gradient(120deg, #14967a, var(--mint));
  color: #04241c;
  border-color: transparent;
}

.act.auto.on .auto-sub { color: rgba(4, 36, 28, 0.75); }

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: 0 16px;
  min-height: 48px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ghost:hover { color: var(--text); border-color: #3d4b5c; }
.ghost:disabled { opacity: 0.35; cursor: not-allowed; }

/* —— Panels —— */
.panels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  animation: rise 0.55s ease 0.12s both;
}

.panel {
  background: rgba(20, 26, 33, 0.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel.danger {
  border-color: rgba(240, 69, 85, 0.35);
  background: linear-gradient(180deg, rgba(240, 69, 85, 0.08), rgba(20, 26, 33, 0.72));
}

.panel h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn {
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  border-radius: 11px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 650;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  transition: filter 0.12s ease, border-color 0.12s ease;
}

.btn:hover { filter: brightness(1.08); border-color: #3d4b5c; }

.btn.accent {
  background: var(--mint-dim);
  border-color: rgba(30, 201, 162, 0.35);
  color: var(--mint);
}

.btn.rug {
  background: linear-gradient(180deg, #ff6b75, #c62836);
  border: none;
  color: #1a0508;
  font-weight: 800;
  padding: 14px;
}

.btn.soft {
  background: var(--red-dim);
  border-color: rgba(240, 69, 85, 0.35);
  color: #ff9aa3;
}

.btn.danger-ghost {
  background: transparent;
  border-color: rgba(240, 69, 85, 0.4);
  color: #ff9aa3;
  margin-top: auto;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.inline-form .btn { width: auto; min-width: 72px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* —— Inputs —— */
select,
input[type="number"],
input[type="text"] {
  width: 100%;
  background: #0b0f13;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 11px;
  padding: 12px 14px;
  font: inherit;
  min-height: 48px;
}

select:focus,
input:focus {
  outline: none;
  border-color: rgba(30, 201, 162, 0.55);
}

/* —— Switch / range —— */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
}

.switch input { position: absolute; opacity: 0; pointer-events: none; }

.switch-ui {
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: #2a3440;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.switch input:checked + .switch-ui {
  background: var(--mint);
}

.switch input:checked + .switch-ui::after {
  transform: translateX(16px);
}

.switch-text { color: var(--text); line-height: 1.3; }

.range {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.range-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.range-head span:last-child {
  font-family: var(--mono);
  color: var(--text);
  font-weight: 500;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--mint);
  height: 6px;
  cursor: pointer;
}

.panel.danger input[type="range"] { accent-color: var(--red); }

/* —— Footer —— */
.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

/* —— Responsive —— */
@media (max-width: 900px) {
  .panels { grid-template-columns: 1fr; }
  .top {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
  .live-strip { width: 100%; }
  .stat { flex: 1; }
  .chart-link { justify-self: start; }
}

@media (max-width: 560px) {
  .actions { grid-template-columns: 1fr; }
  .move-controls { grid-template-columns: 1fr; }
  .chaos-range { grid-template-columns: 1fr; }
  .act.auto { grid-column: auto; flex-direction: column; gap: 4px; }
  .form-grid { grid-template-columns: 1fr; }
  .token-bar { flex-direction: column; align-items: stretch; }
  .ghost { min-height: 44px; }
  .foot { flex-direction: column; }
  .live-strip { flex-wrap: wrap; }
}
