body {
  font-family: system-ui, sans-serif;
  background: #fafafa;
  color: #222;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

header h1 {
  margin: 0 0 4px;
}

header p {
  margin: 0 0 16px;
  color: #666;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

fieldset {
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  padding: 10px 12px;
}

legend {
  padding: 0 4px;
  font-weight: 600;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  margin-bottom: 8px;
  color: #555;
}

label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

label.checkbox input {
  margin: 0;
}

label input,
label select {
  margin-top: 2px;
  padding: 4px 6px;
  font: inherit;
}

button {
  padding: 6px 10px;
  border: 1px solid #888;
  border-radius: 4px;
  background: #f3f3f3;
  cursor: pointer;
}

.presets {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.presets-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  font-weight: 600;
}

.presets button {
  padding: 4px 8px;
  font-size: 12px;
  text-align: left;
}

button:hover {
  background: #e8e8e8;
}

#eventList {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 12px;
}

#eventList li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

#eventList .swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid #999;
  border-radius: 2px;
}

#eventList .remove {
  margin-left: auto;
  border: none;
  background: transparent;
  color: #a33;
  cursor: pointer;
}

.canvas {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 12px;
  overflow: auto;
  max-height: 70vh;
}

.events {
  margin-top: 16px;
  display: block;
}

.events fieldset {
  box-sizing: border-box;
}

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

.event-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.event-form label {
  flex: 1 1 140px;
  margin-bottom: 0;
}

.event-form button {
  flex: 0 0 auto;
  height: 28px;
}

.type-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.type-form label {
  flex: 1 1 140px;
  margin-bottom: 0;
}

.type-form button {
  flex: 0 0 auto;
  height: 28px;
}

#typeList {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 12px;
}

#typeList li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

#typeList .swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid #999;
  border-radius: 2px;
}

#typeList .remove {
  margin-left: auto;
  border: none;
  background: transparent;
  color: #a33;
  cursor: pointer;
}

.canvas svg {
  display: block;
}

.subhead {
  margin: 6px 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  font-weight: 600;
}

.subhead:first-child {
  margin-top: 0;
}

.hl-group {
  margin-bottom: 8px;
}

.hl-label {
  display: block;
  font-size: 12px;
  color: #555;
  margin-bottom: 4px;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.toggle-row button {
  padding: 3px 7px;
  font-size: 12px;
  border: 1px solid #bbb;
  background: #f7f7f7;
  color: #555;
  border-radius: 3px;
}

.toggle-row button.active {
  border-color: #2a6;
  background: #e6f7ec;
  color: #163;
  font-weight: 600;
}
