:root {
  --black: #111;
  --ink: #292929;
  --mid: #777;
  --line: #d5d5d5;
  --soft: #f5f5f5;
  --white: #fff;
  font-family: Arial, Helvetica, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--ink);
  background: var(--white);
  font-size: 14px;
}
.topbar {
  height: 72px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1120px) / 2));
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}
.mark {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 2px solid var(--black);
  font-size: 20px;
  line-height: 1;
}
.kicker {
  margin: 0;
  color: var(--mid);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}
.brand .kicker {
  margin-bottom: 2px;
}
.brand h1 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.02em;
}
.text-button {
  border: 0;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--mid);
  padding: 8px 0;
  font-size: 12px;
}
.text-button:hover {
  color: var(--black);
}
.layout {
  max-width: 1120px;
  margin: auto;
  padding: 24px 24px 30px;
}
.intro {
  max-width: 540px;
  margin-bottom: 42px;
}
.intro h2 {
  margin: 0 0 12px;
  color: var(--black);
  font-size: clamp(34px, 5vw, 52px);
  line-height: 0.98;
  letter-spacing: -0.06em;
}
.intro > p:last-child {
  margin: 0;
  color: var(--mid);
  font-size: 15px;
  line-height: 1.6;
}
.workspace {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
}
.panel {
  border: 1px solid var(--line);
  padding: 20px;
  background: #fff;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  min-height: 47px;
}
.panel h3 {
  margin: 0;
  font-size: 17px;
  color: var(--black);
}
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 10px 0 22px; border: 1px solid var(--line); background: var(--soft); }
.mode-button { border: 1px solid transparent; background: transparent; color: var(--mid); padding: 10px 12px; font-size: 12px; font-weight: 700; cursor: pointer; }
.mode-button:hover { color: var(--black); background: #fff; }
.mode-button.active { border-color: var(--black); background: var(--black); color: #fff; }
.subheading { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; }
.subheading output { color: var(--black); font-size: 20px; }
.count,
.helper,
.input-footer,
.range-labels {
  color: var(--mid);
  font-size: 12px;
}
.count {
  padding-top: 18px;
}
textarea {
  width: 100%;
  min-height: 164px;
  border: 1px solid #aaa;
  border-radius: 0;
  resize: vertical;
  padding: 12px;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
}
textarea:focus,
input:focus,
button:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}
.invalid {
  outline: 2px solid #888;
}
.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 9px;
}
.small-button {
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 6px 8px;
  color: var(--ink);
  font-size: 11px;
}
.small-button:hover {
  border-color: var(--black);
  background: #fff;
}
.panel output {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--black);
  color: #fff;
  font-size: 18px;
}
.stepper {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 22px 0 7px;
}
.stepper button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--black);
  background: #fff;
  font-size: 20px;
  line-height: 1;
}
.stepper button:hover {
  background: var(--black);
  color: #fff;
}
input[type="range"] {
  --progress: 0%;
  width: 100%;
  height: 4px;
  appearance: none;
  background: linear-gradient(to right, var(--black) var(--progress), #ddd var(--progress));
  outline: 0;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--black);
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
}
.range-labels {
  display: flex;
  justify-content: space-between;
}
.helper {
  margin: 22px 0 0;
}
.actions {
  grid-column: 1/-1;
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.primary-button,
.secondary-button {
  border: 1px solid var(--black);
  padding: 12px 16px;
  font-weight: 700;
  font-size: 12px;
}
.primary-button {
  background: var(--black);
  color: #fff;
}
.primary-button:hover {
  background: #444;
}
.primary-button span {
  margin-left: 20px;
  font-size: 16px;
}
.secondary-button {
  background: #fff;
}
.secondary-button:hover {
  background: var(--soft);
}
.results {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 2px solid var(--black);
}
.results-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 22px;
}
.results h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.04em;
  color: var(--black);
}
.result-meta {
  color: var(--mid);
  font-size: 12px;
}
.groups {
  overflow-x: auto;
}
.results-table { width: 100%; min-width: 520px; border-collapse: collapse; table-layout: fixed; }
.results-table th, .results-table td { border: 1px solid var(--line); padding: 12px; text-align: left; vertical-align: top; }
.results-table th { background: var(--black); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.results-table td { color: var(--black); min-height: 44px; }
.results-table tbody tr:nth-child(even) td { background: var(--soft); }
.group-card {
  border: 1px solid var(--black);
  min-height: 155px;
}
.group-top {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--mid);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.members {
  padding: 5px 12px;
}
.member {
  padding: 10px 0;
  border-bottom: 1px solid #e8e8e8;
  color: var(--black);
}
.member:last-child {
  border-bottom: 0;
}
.empty {
  min-height: 190px;
  border: 1px dashed #aaa;
}
.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 190px;
  color: var(--mid);
  text-align: center;
}
.empty-icon {
  font-size: 28px;
  color: var(--black);
  margin-bottom: 9px;
}
.empty-state p {
  margin: 0 0 3px;
  color: var(--ink);
  font-weight: 700;
}
.empty-state small {
  font-size: 12px;
}
footer {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--mid);
  font-size: 11px;
}
@media (max-width: 680px) {
  .layout {
    padding-top: 38px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .actions {
    grid-column: auto;
  }
  .results {
    margin-top: 45px;
  }
  .results-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }
  .topbar {
    padding: 0 16px;
  }
  footer {
    gap: 12px;
    align-items: flex-start;
    flex-direction: column;
  }
}
@media print {
  .topbar,
  .intro,
  .workspace,
  footer {
    display: none;
  }
  .layout {
    padding: 25px;
  }
  .results {
    margin: 0;
    border: 0;
  }
  .results-table { min-width: 0; font-size: 11px; }
  .results-table th, .results-table td { border: 1px solid #999; padding: 7px; }
}
