:root {
  font-family: Inter, system-ui, sans-serif;
  color: #16181d;
  background: #fff;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
main { max-width: 1160px; margin: auto; padding: 20px 16px 48px; }
header { margin-bottom: 20px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.01em; }
header p { margin-top: 6px; font-size: 15px; line-height: 1.45; color: #5b6270; }
.tool, form, .field, #grouping { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.field { gap: 6px; }
label { font-size: 14px; font-weight: 600; }
label span { color: #5b6270; font-weight: 400; }
textarea, input, button { font: inherit; }
textarea, input { border: 1.5px solid #c9ced6; border-radius: 10px; color: inherit; background: white; font-size: 16px; padding: 10px 12px; }
textarea { display: block; width: 100%; line-height: 1.4; resize: vertical; }
input { width: 104px; height: 44px; }
button { width: 100%; min-height: 52px; padding: 12px 16px; border: 0; border-radius: 12px; color: white; background: #1f5bd8; font-size: 17px; font-weight: 600; cursor: pointer; }
button:hover { background: #1747ae; }
button:disabled { cursor: wait; opacity: .7; }
:focus-visible { outline: 3px solid #1f5bd8; outline-offset: 3px; }
[aria-invalid="true"] { border-color: #b42318; }
.error { color: #b42318; font-size: 14px; line-height: 1.4; }
.help { color: #5b6270; font-size: 14px; line-height: 1.4; }
#grouping { gap: 12px; padding-top: 8px; scroll-margin-top: 12px; }
h2 { font-size: 20px; }
.grouping-header { display: grid; gap: 12px; }
#grouping-summary { margin-top: 2px; }
#stale-notice { padding: 10px 12px; border-radius: 10px; background: #fff4e5; color: #7a3e00; font-size: 14px; line-height: 1.4; }
.grouping-actions { display: flex; gap: 8px; }
.grouping-actions button { flex: 1; min-height: 44px; padding: 10px 18px; border: 1.5px solid #c9ced6; border-radius: 10px; color: #16181d; background: white; font-size: 15px; }
.grouping-actions button:hover { background: #f7f8fa; }
#regroup { border-color: #1f5bd8; color: #1f5bd8; }
#regroup:hover { background: #f0f5ff; }
#group-cards.stale { opacity: .45; }
#group-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.group-card { border: 1px solid #dde1e7; border-radius: 12px; padding: 14px 16px; background: #f7f8fa; min-width: 0; }
.group-card h3 { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #1f5bd8; margin-bottom: 6px; }
.group-card ul { margin: 0; padding: 0; list-style: none; }
.group-card li { font-size: 20px; font-weight: 600; line-height: 1.35; margin-top: 2px; overflow-wrap: anywhere; }
.guide { display: grid; gap: 24px; border-top: 1px solid #e6e9ee; margin-top: 20px; padding-top: 16px; }
.guide h2 { font-size: 18px; margin-bottom: 10px; }
.guide h3 { font-size: 16px; margin: 16px 0 6px; }
.guide p, .guide ol { font-size: 15px; line-height: 1.5; color: #3a3f4a; }
.guide ol { margin: 0; padding-left: 20px; }
.guide li + li { margin-top: 4px; }
@media (min-width: 900px) {
  main { padding: 48px 24px 64px; }
  header { margin-bottom: 32px; }
  h1 { font-size: 36px; line-height: 1.15; }
  header p { font-size: 17px; margin-top: 8px; }
  .tool { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 32px; align-items: start; }
  form { gap: 18px; padding: 24px; border: 1px solid #e1e5eb; border-radius: 16px; }
  #grouping { gap: 16px; padding-top: 0; }
  .grouping-header { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .grouping-actions { grid-column: 2; grid-row: 1; }
  .grouping-actions button { width: auto; flex: none; }
  #stale-notice { grid-column: 1 / -1; }
  #grouping h2 { font-size: 24px; }
  #group-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .group-card { padding: 18px 20px; border-radius: 14px; }
  .group-card li { font-size: 22px; line-height: 1.4; }
  .guide { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 32px; padding-top: 24px; margin-top: 32px; }
}
