:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1d2939;
  --line: #d0d5dd;
  --accent: #175cd3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

main {
  max-width: 760px;
  margin: 2rem auto;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

h1 {
  margin-top: 0;
}

label {
  display: block;
  margin: 0.75rem 0 0.35rem;
  font-weight: 600;
}

#sourceCount {
  margin: 0.45rem 0 0;
  color: #475467;
}

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

textarea,
input,
select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

textarea {
  min-height: 180px;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.example-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

.buttons {
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

button {
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

#generate {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

#status {
  min-height: 1.2rem;
  margin: 0.8rem 0 0.6rem;
}

#output {
  margin: 0;
  padding: 0.8rem;
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  white-space: pre-wrap;
}

#transitionsPanel {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
}

#transitionsPanel > summary {
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  font-weight: 600;
}

#transitionSummary {
  margin: 0;
  padding: 0 0.8rem 0.55rem;
  color: #475467;
}

#transitionPairs {
  margin: 0;
  padding: 0.8rem;
  border-top: 1px solid var(--line);
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  background: #f8fafc;
}

@media (max-width: 600px) {
  .controls {
    grid-template-columns: 1fr;
  }

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