:root {
  --background: #f1ede4;
  --paper: #fffdf7;
  --ink: #29252e;
  --muted: #6f6875;
  --line: #d9d0c1;
  --purple: #5d3f72;
  --purple-dark: #402852;
  --purple-soft: #eee7f2;
  --yellow: #fff8d8;
  --focus: #b76127;
  color-scheme: light;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.6;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--background);
  color: var(--ink);
  margin: 0;
}

a {
  color: var(--purple-dark);
}

a:hover,
a:focus {
  color: var(--focus);
}

button,
select,
textarea {
  font: inherit;
}

.site-width {
  margin: 0 auto;
  max-width: 1280px;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.site-header {
  background: #d7d6d4;
  border-top: 3px solid #eadeda;
  color: var(--ink);
  padding: 1.2rem 0 1.05rem;
}

.site-title {
  color: #c7221d;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  text-decoration: none;
}

.site-heading {
  line-height: 1;
  margin: 0;
}

.site-title:hover,
.site-title:focus {
  color: #9f1d19;
}

.site-header p {
  color: #686269;
  font-style: italic;
  margin: 0.25rem 0 0;
}

main {
  padding-bottom: 3rem;
  padding-top: 1.75rem;
}

.workbench,
.result,
.about {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 8px 24px rgb(55 42 29 / 6%);
  margin-bottom: 1.2rem;
  padding: clamp(1.1rem, 3vw, 1.8rem);
}

h1,
h2 {
  color: #2d2533;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.45rem, 3vw, 2rem);
  letter-spacing: -0.025em;
  margin: 0 0 0.55rem;
}

h2 {
  font-size: clamp(1.15rem, 2.5vw, 1.4rem);
  margin: 0 0 0.65rem;
}

p {
  margin-bottom: 0.8rem;
  margin-top: 0.8rem;
}

q {
  color: var(--purple-dark);
  font-style: italic;
}

label {
  display: block;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.workbench form {
  align-items: start;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 3fr) minmax(13rem, 1fr);
}

.panel-heading {
  align-items: baseline;
  display: flex;
  gap: 0.5rem;
}

.filename {
  color: #34713c;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  font-style: italic;
  font-weight: 400;
}

select,
textarea {
  background: #ffffff;
  border: 1px solid #bdb3c2;
  border-radius: 5px;
  color: var(--ink);
}

.dataset-panel select {
  min-height: 18.6rem;
  padding: 0.4rem;
  width: 100%;
}

textarea {
  display: block;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  min-height: 18.6rem;
  padding: 0.8rem;
  resize: vertical;
  width: 100%;
}

select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(183 97 39 / 35%);
  outline-offset: 2px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

button {
  background: var(--purple);
  border: 1px solid var(--purple);
  border-radius: 5px;
  color: #ffffff;
  cursor: pointer;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.55rem 0.85rem;
}

button:hover {
  background: var(--purple-dark);
}

button.secondary {
  background: #ffffff;
  color: var(--purple-dark);
}

button.secondary:hover {
  background: var(--purple-soft);
}

.hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0;
}

.result {
  background: var(--yellow);
}

.result-heading {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  justify-content: space-between;
}

.result-heading p {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
}

pre {
  background: #fffde7;
  border: 1px solid #e6dca9;
  border-radius: 4px;
  color: #17151a;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  margin: 0.55rem 0 0;
  min-height: 15rem;
  overflow-x: auto;
  padding: 1rem;
}

.errors {
  background: #fff0eb;
  border: 1px solid #dfb09f;
  border-radius: 5px;
  color: #71351f;
  font-size: 0.85rem;
  margin-top: 0.8rem;
  padding: 0.7rem 0.9rem;
  white-space: pre-line;
}

.about {
  color: #4f4853;
  font-size: 0.92rem;
}

.site-footer {
  color: var(--muted);
  font-size: 0.76rem;
  padding: 0 0 2rem;
  text-align: center;
}

.site-footer p {
  margin-bottom: 0.2rem;
}

@media (max-width: 640px) {
  :root {
    font-size: 15px;
  }

  .site-width {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  main {
    padding-top: 1rem;
  }

  .workbench form {
    grid-template-columns: 1fr;
  }

  .dataset-panel select,
  textarea {
    min-height: 15rem;
  }
}

@media print {
  .site-header,
  .workbench,
  .about,
  .site-footer,
  .errors {
    display: none;
  }

  body,
  .result {
    background: #ffffff;
  }

  .result {
    border: 0;
    box-shadow: none;
  }

  pre {
    background: #ffffff;
    color: #000000;
  }
}
