:root {
  color: #173238;
  background: #f4f7f5;
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1.45;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

main {
  max-width: 1200px;
  margin: auto;
  padding: 32px 24px 48px;
}

header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #cbd8d4;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0 0 8px;
  color: #16766c;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.lede {
  margin: 8px 0 0;
  color: #52706e;
}

button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid #9ab5af;
  border-radius: 6px;
  background: white;
  color: #173238;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

button:hover {
  border-color: #16766c;
}

.primary {
  border-color: #16766c;
  background: #16766c;
  color: white;
}

.rules-disclosure {
  margin: 16px 0;
  border-bottom: 1px solid #cbd8d4;
}

.rules-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: 24px;
  padding: 6px 2px;
  cursor: pointer;
  list-style: none;
}

.rules-disclosure summary::-webkit-details-marker {
  display: none;
}

.rules-disclosure summary strong,
.rules-disclosure summary small {
  display: block;
}

.rules-disclosure summary small {
  margin-top: 2px;
  color: #6d8582;
  font-size: 0.78rem;
  font-weight: 500;
}

.disclosure-action {
  color: #16766c;
  font-size: 0.85rem;
  font-weight: 700;
}

.disclosure-action::before {
  content: "View rules +";
}

.rules-disclosure[open] .disclosure-action::before {
  content: "Hide rules −";
}

.rules-body {
  padding: 8px 0 20px;
}

.rules-body textarea {
  height: 320px;
}

.rules-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
}

.panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid #cbd8d4;
  border-radius: 8px;
  background: white;
}

.workbench {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label,
h2 {
  display: block;
  margin: 0 0 10px;
  font-weight: 750;
}

textarea {
  display: block;
  width: 100%;
  height: 360px;
  padding: 12px;
  overflow: auto;
  border: 1px solid #9ab5af;
  border-radius: 5px;
  resize: vertical;
  background: #fbfdfc;
  color: #173238;
  font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre;
}

textarea:focus,
button:focus,
summary:focus,
pre:focus {
  outline: 3px solid #a7d8cf;
  outline-offset: 2px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.actions span {
  color: #52706e;
  font-size: 0.9rem;
}

.hint {
  margin: 0;
  color: #52706e;
  font-size: 0.85rem;
}

code {
  font-family: ui-monospace, monospace;
}

.output pre {
  min-height: 360px;
  max-height: 500px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  border-radius: 5px;
  background: #172f33;
  color: #e5f3ee;
  font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

@media (max-width: 700px) {
  main {
    padding: 20px 16px 36px;
  }

  header {
    display: block;
  }

  header button {
    width: 100%;
    margin-top: 18px;
  }

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

  textarea,
  .rules-body textarea {
    height: 260px;
  }

  .rules-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    flex-wrap: wrap;
  }

  .actions button,
  .rules-footer button {
    width: 100%;
  }
}
