:root {
  --bg: #151924;
  --panel: #1b2030;
  --line: #3a4154;
  --text: #e6e8ee;
  --muted: #8a90a0;
  --accent: #5865f2;
  --buy: #2ecc71;
  --sell: #e74c3c;
  --toolbar-h: 56px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body { display: flex; flex-direction: column; overflow: hidden; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  min-height: var(--toolbar-h);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex-wrap: wrap;
}

#query-form, .toolbar-actions { display: flex; align-items: stretch; flex-wrap: wrap; }

.field {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 6px 14px;
  border-right: 1px solid var(--line);
}
.field > span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

input, select, button {
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
}
input[type="text"], input[type="number"], input[type="datetime-local"], select {
  padding: 3px 6px;
  border-color: var(--line);
  background: var(--panel);
}
input:focus, select:focus, button:focus-visible { outline: 1px solid var(--accent); outline-offset: 0; }
select option { background: var(--panel); }

.field-symbol input { width: 140px; text-transform: uppercase; font-size: 17px; font-weight: 600; }
.field-address input { width: 230px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

.duration-row { display: flex; align-items: center; gap: 8px; }
.duration-row input[type="range"] { width: 180px; accent-color: var(--accent); }
.duration-row input[type="number"] { width: 68px; }
.duration-row em { font-style: normal; color: var(--muted); }

button { cursor: pointer; padding: 0 18px; }
#generate {
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-right: 1px solid var(--line);
  border-radius: 0;
}
#generate:hover, .toolbar-actions button:hover { background: var(--panel); }
#generate:disabled { opacity: .5; cursor: progress; }

.toolbar-actions button { color: var(--muted); border-radius: 0; border-left: 1px solid var(--line); }
.toolbar-actions button[aria-pressed="true"] { color: var(--text); background: var(--panel); }
.toolbar-actions button:disabled { opacity: .35; cursor: default; background: none; }

/* ---------- stage ---------- */
.stage { position: relative; flex: 1; min-height: 0; }
#chart { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(ellipse at center, #1e2436 0%, var(--bg) 70%);
}
.overlay.transparent { background: none; }
.overlay[hidden] { display: none; }

.intro { max-width: 680px; padding: 24px; color: #c8ccd6; pointer-events: auto; }
.intro h1 { margin: 0 0 12px; font-size: 26px; color: var(--text); }
.intro ul { padding-left: 18px; }
.intro li { margin: 6px 0; }
.intro .buy { color: var(--buy); }
.intro .sell { color: var(--sell); }
code, kbd {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
}

.error { color: #ff8a80; font-size: 16px; text-align: center; max-width: 600px; padding: 0 24px; }

.loading { display: flex; gap: 12px; align-items: center; height: 80px; }
.loading i {
  display: block;
  width: 14px;
  height: 40px;
  background: var(--text);
  animation: bounce 1.2s ease-in-out infinite;
}
.loading i:nth-child(2) { animation-delay: .15s; }
.loading i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce {
  0%, 100% { transform: translateY(0) scaleY(.7); }
  50% { transform: translateY(-14px) scaleY(1.2); }
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 6px;
  pointer-events: none;
}
