:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f5f8;
  color: #1a202c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 32px auto;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
}

.panel {
  background: #ffffff;
  border: 1px solid #d7dde7;
  border-radius: 8px;
  padding: 18px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

p {
  margin: 5px 0 0;
  color: #5b6575;
}

a {
  color: #0f766e;
  font-weight: 700;
  text-decoration: none;
}

form,
label {
  display: grid;
  gap: 8px;
}

form {
  gap: 16px;
}

label span {
  font-size: 13px;
  font-weight: 700;
  color: #394150;
}

textarea,
input {
  width: 100%;
  border: 1px solid #b8c1cf;
  border-radius: 6px;
  font: inherit;
  color: inherit;
  background: #ffffff;
}

textarea {
  min-height: 220px;
  padding: 12px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

input {
  padding: 9px 10px;
}

.file-row input {
  padding: 8px;
}

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

button {
  height: 42px;
  border: 0;
  border-radius: 6px;
  background: #0f766e;
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.results {
  min-width: 0;
  display: grid;
  gap: 14px;
  align-content: start;
}

canvas {
  width: 100%;
  height: auto;
  border: 1px solid #d7dde7;
  border-radius: 6px;
  background: #fbfcfe;
}

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

.stat {
  border: 1px solid #d7dde7;
  border-radius: 6px;
  padding: 10px;
}

.stat strong {
  display: block;
  font-size: 18px;
}

.stat span {
  display: block;
  color: #647084;
  font-size: 12px;
  margin-top: 2px;
}

.json-output {
  min-height: 360px;
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  resize: vertical;
  border-radius: 6px;
  border: 1px solid #111827;
  background: #111827;
  color: #d1d5db;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    width: min(100vw - 20px, 680px);
    margin: 10px auto;
  }

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