:root {
  color: #352f48;
  background: #f7f4ff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 8%, rgb(255 188 211 / 42%), transparent 28%),
    radial-gradient(circle at 92% 20%, rgb(164 229 239 / 48%), transparent 30%),
    linear-gradient(145deg, #fff9fc, #f2f2ff 52%, #f4fdff);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: saturate(1.08);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(114 89 223 / 28%);
  outline-offset: 2px;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.page-shell {
  width: min(100% - 24px, 1080px);
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 0 64px;
}

.card {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid #e9e2f6;
  border-radius: 22px;
  background: rgb(255 255 255 / 90%);
  box-shadow: 0 14px 38px rgb(76 54 120 / 10%);
  backdrop-filter: blur(8px);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 30px;
  background:
    linear-gradient(120deg, rgb(255 255 255 / 96%), rgb(249 244 255 / 92%));
}

.hero::after {
  position: absolute;
  width: 130px;
  height: 130px;
  right: -34px;
  top: -52px;
  border-radius: 42% 58% 63% 37%;
  background: linear-gradient(135deg, #ffd0df, #a9e7ef);
  content: "";
  opacity: 0.72;
  transform: rotate(18deg);
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0.25rem 0 0.5rem;
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1.15;
}

h2 {
  margin-top: 0;
}

.eyebrow {
  color: #7759d7;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.input-row,
.results {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

label[for="bulk-names"] {
  display: block;
  margin: 18px 0 7px;
  font-weight: 750;
}

#add-bulk,
#reset-members {
  margin-top: 9px;
}

.results {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.section-heading,
.selection-actions,
.member-row {
  display: flex;
  align-items: center;
}

.section-heading {
  justify-content: space-between;
  gap: 12px;
}

.selection-actions {
  gap: 8px;
}

#member-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.member-row {
  min-width: 0;
  gap: 9px;
  padding: 9px;
  border: 1px solid #e8e1f3;
  border-radius: 14px;
  background: #fbfaff;
}

.member-check {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  accent-color: #7259df;
}

.member-name {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.delete-member {
  min-height: 36px;
  padding: 6px 10px;
  background: #fff0f3;
  color: #a23e58;
}

.notification {
  min-height: 1.5em;
  color: #62567b;
  font-weight: 650;
}

input,
textarea,
button {
  min-height: 46px;
  border-radius: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid #dcd3ee;
  padding: 11px 14px;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

button {
  border: 0;
  padding: 10px 18px;
  background: #ece7f8;
  color: inherit;
  font-weight: 700;
}

.button-primary {
  width: 100%;
  background: linear-gradient(135deg, #7259df, #ff6f91);
  color: white;
  box-shadow: 0 9px 22px rgb(114 89 223 / 25%);
}

.button-secondary {
  width: 100%;
  margin-top: 10px;
  border: 2px solid #7259df;
  background: white;
  color: #6248c8;
}

.drawing-status {
  min-height: 1.5em;
  margin-bottom: 0;
  text-align: center;
  font-weight: 700;
}

.canvas-wrap {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid #eee8f6;
  border-radius: 16px;
  background: #fff;
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
}

.result-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

#show-member-editor {
  width: 100%;
  margin-bottom: 10px;
  border: 2px solid #d9d0ee;
  background: #fff;
  color: #6248c8;
}

.result-list li {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgb(255 255 255 / 72%);
  overflow-wrap: anywhere;
  font-weight: 700;
}

.result-color {
  width: 5px;
  height: 28px;
  border-radius: 999px;
}

.result-number {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 2px solid;
  border-radius: 50%;
  background: white;
  font-size: 0.8rem;
  font-weight: 850;
}

.result-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-a {
  background: #f1edff;
  border: 2px solid #bcb0f2;
}

.result-b {
  background: #eafcff;
  border: 2px solid #99dce5;
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 16px, 1080px);
    padding-top: 12px;
  }

  .card {
    padding: 17px;
    border-radius: 18px;
  }

  .hero {
    padding: 22px 19px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  #member-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .results {
    gap: 8px;
  }

  .result-card {
    padding: 12px 9px;
  }

  .result-card h2 {
    font-size: clamp(0.9rem, 4vw, 1.1rem);
  }

  .result-list {
    gap: 6px;
  }

  .result-list li {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 5px;
    padding: 7px 5px;
    font-size: 0.78rem;
  }

  .result-color {
    display: none;
  }

  .result-number {
    width: 23px;
    height: 23px;
    font-size: 0.7rem;
  }
}

@media (max-width: 430px) {
  #member-list {
    grid-template-columns: 1fr;
  }

  .selection-actions {
    width: 100%;
  }

  .selection-actions button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body {
    background: white;
  }

  .member-editor,
  .draw-actions {
    display: none !important;
  }

  .page-shell {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .card {
    break-inside: avoid;
    box-shadow: none;
  }
}
