:root {
  color-scheme: dark;
  --bg: #10110f;
  --panel: #f6f0df;
  --ink: #171713;
  --muted: #58554d;
  --acid: #c7ff3e;
  --pink: #ff4f9a;
  --cyan: #4de4ff;
  --line: rgba(255, 255, 255, 0.18);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(199, 255, 62, 0.16), transparent 28%),
    linear-gradient(315deg, rgba(255, 79, 154, 0.18), transparent 30%),
    var(--bg);
  color: #fff;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--acid);
  color: #111;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.tool-pane,
.side-pane {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.tool-pane {
  display: grid;
  grid-template-rows: auto minmax(280px, 1fr) auto auto;
  gap: 14px;
  padding: 18px;
}

.title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.label {
  margin: 0 0 6px;
  color: var(--acid);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2.2rem, 6vw, 5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.badge {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

canvas {
  width: 100%;
  max-height: 58vh;
  min-height: 280px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: #f7f0d9;
  object-fit: contain;
}

.result-panel {
  padding: 16px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.result-panel h2 {
  margin-bottom: 8px;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  letter-spacing: 0;
}

.result-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.controls button:nth-child(2) {
  background: var(--cyan);
}

.controls button:nth-child(3) {
  background: var(--pink);
  color: #fff;
}

.side-pane {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
}

.side-pane section {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.side-pane section:last-child {
  border-bottom: 0;
}

.side-pane h2 {
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.kpi-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
}

.kpi-grid span {
  display: block;
  color: var(--acid);
  font-size: 1.8rem;
  font-weight: 900;
}

.kpi-grid p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
}

.history-list {
  min-height: 180px;
  margin: 0;
  padding-left: 24px;
}

.history-list li,
.rules li {
  margin-bottom: 10px;
  line-height: 1.5;
}

.rules ul {
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-pane {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

  .title-row,
  .controls {
    grid-template-columns: 1fr;
  }

  .title-row {
    display: grid;
  }
}
