:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: rgba(16, 24, 44, 0.82);
  --panel-strong: rgba(23, 34, 62, 0.95);
  --border: rgba(148, 163, 184, 0.22);
  --text: #e5edf8;
  --muted: #9aa9bd;
  --accent: #7dd3fc;
  --accent-strong: #38bdf8;
  --danger: #fca5a5;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.28);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.2), transparent 32rem),
    radial-gradient(circle at 80% 20%, rgba(168, 85, 247, 0.16), transparent 30rem),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 36px;
}

.hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.6rem);
  line-height: 0.96;
  margin-bottom: 14px;
}

h2 {
  font-size: 1rem;
  margin-bottom: 18px;
}

.lead {
  max-width: 820px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.runtime-card {
  min-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.runtime-card span {
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 800;
}

.runtime-card small {
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 22px;
  margin-bottom: 22px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.controls {
  padding: 22px;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

label span,
.editor-header span,
.pill {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  background: rgba(3, 7, 18, 0.42);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(125, 211, 252, 0.75);
  box-shadow: 0 0 0 4px rgba(125, 211, 252, 0.1);
}

input,
select {
  min-height: 44px;
  padding: 0 13px;
}

textarea {
  min-height: 480px;
  padding: 18px;
  resize: vertical;
  line-height: 1.6;
  white-space: pre;
}

.workspace {
  overflow: hidden;
}

.editor-header,
.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 0;
}

.workspace textarea {
  border-width: 1px 0 0;
  border-radius: 0 0 var(--radius) var(--radius);
  min-height: 558px;
  margin-top: 12px;
}

.summary {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.summary ul {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.summary li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.summary small,
.muted {
  color: var(--muted);
}

.chart-panel {
  padding-bottom: 24px;
}

.chart-header p {
  color: var(--muted);
  margin: -8px 0 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.08);
}

.chart-box {
  margin: 22px;
  overflow: auto;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.96));
}

svg {
  width: 100%;
  min-width: 760px;
  height: auto;
  display: block;
}

.chart-title {
  fill: var(--text);
  font-size: 22px;
  font-weight: 800;
  text-anchor: middle;
}

.axis,
.zero-line {
  stroke: rgba(226, 232, 240, 0.42);
  stroke-width: 1.2;
}

.zero-line {
  stroke-dasharray: 5 5;
}

.grid-line {
  stroke: rgba(148, 163, 184, 0.13);
  stroke-width: 1;
}

.tick-label {
  fill: var(--muted);
  font-size: 12px;
  text-anchor: end;
}

.x-label {
  fill: var(--muted);
  font-size: 12px;
  text-anchor: middle;
}

.bar-label {
  fill: var(--text);
  font-size: 13px;
  text-anchor: end;
}

.value-label {
  fill: var(--muted);
  font-size: 12px;
}

.bar-fill,
.point-fill {
  fill: var(--accent-strong);
  opacity: 0.92;
}

.bar-fill:hover,
.point-fill:hover,
.pie-fill:hover {
  opacity: 1;
  filter: drop-shadow(0 0 12px rgba(125, 211, 252, 0.35));
}

.line-stroke {
  fill: none;
  stroke: var(--accent-strong);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pie-hole {
  fill: #0f172a;
  stroke: rgba(226, 232, 240, 0.16);
}

.donut-total {
  fill: var(--text);
  font-size: 24px;
  font-weight: 800;
  text-anchor: middle;
}

.donut-caption {
  fill: var(--muted);
  font-size: 13px;
  text-anchor: middle;
}

.legend-label {
  fill: var(--text);
  font-size: 13px;
}

.legend-swatch,
.pie-fill {
  opacity: 0.94;
}

.fill-0 { fill: #38bdf8; }
.fill-1 { fill: #a78bfa; }
.fill-2 { fill: #34d399; }
.fill-3 { fill: #fbbf24; }
.fill-4 { fill: #fb7185; }
.fill-5 { fill: #60a5fa; }
.fill-6 { fill: #f472b6; }
.fill-7 { fill: #c4b5fd; }

.error,
.empty {
  margin: 22px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(252, 165, 165, 0.09);
  color: var(--danger);
}

.empty {
  background: rgba(148, 163, 184, 0.08);
  color: var(--muted);
}

@media (max-width: 980px) {
  .shell {
    padding: 22px;
  }

  .hero,
  .grid {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
}
