:root {
  --bg: #f3efe7;
  --ink: #1c1b1a;
  --accent: #f26b3a;
  --card: #fffaf2;
  --shadow: rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "GT America", "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff7e6 0%, var(--bg) 55%, #efe6d6 100%);
  min-height: 100vh;
}

body.complete {
  background: radial-gradient(circle at top left, #e6ffe6 0%, #b7f3b7 55%, #8be28b 100%);
}

body.complete .category {
  display: none;
}

header {
  padding: 32px 6vw 8px;
  position: relative;
}

header h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

header p {
  margin: 8px 0 0;
  max-width: 720px;
  font-size: 1rem;
  line-height: 1.6;
}

.help-buttons {
  position: absolute;
  top: 28px;
  right: 6vw;
  display: flex;
  gap: 8px;
}

.help-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #e2d9c8;
  background: #fffaf2;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 6px 16px var(--shadow);
}

.help-button:hover {
  border-color: var(--accent);
}

.status-line {
  margin-top: 6px;
  font-weight: 600;
  color: #5b554f;
}

main {
  padding: 16px 6vw 60px;
}

@media (max-width: 640px) {
  main {
    padding: 12px 0 40px;
  }

  .categories {
    gap: 0;
  }

  .pinned {
    margin-bottom: 0;
  }
}

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

.category {
  background: var(--card);
  border: 1px solid #e2d9c8;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 10px 30px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 640px) {
  .category {
    margin: 0;
    border-radius: 0;
  }
}

.items {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.items__col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 120px;
}

.controls {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.controls label {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #6a5f54;
}

.controls textarea {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e2d9c8;
  font-size: 0.95rem;
  resize: vertical;
  background: #fffaf2;
}

.controls__input {
  position: relative;
}

.controls__clear {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #e2d9c8;
  background: #fffaf2;
  font-weight: 700;
  cursor: pointer;
}

.controls__clear:hover {
  border-color: var(--accent);
}

.controls__actions {
  display: flex;
  gap: 10px;
}

.controls__actions button {
  background: var(--accent);
  color: #1c1b1a;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
}

.help-modal {
  border: none;
  border-radius: 18px;
  padding: 0;
  max-width: 520px;
  width: min(90vw, 520px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.help-modal::backdrop {
  background: rgba(23, 21, 19, 0.45);
  backdrop-filter: blur(2px);
}

.help-modal__content {
  padding: 24px;
  background: #fffaf2;
}

.help-modal__content h2 {
  margin-top: 0;
}

.help-modal__content pre {
  margin: 8px 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f3efe7;
  border: 1px solid #e2d9c8;
  white-space: pre-wrap;
}

.help-modal__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.help-modal__actions button {
  background: #1c1b1a;
  color: #fffaf2;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
}

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 20;
}

.confetti__piece {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 14px;
  opacity: 0.9;
  animation: confetti-fall 2.6s linear forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(var(--x), -20px, 0) rotate(0deg);
  }
  100% {
    transform: translate3d(calc(var(--x) + var(--drift)), 110vh, 0) rotate(520deg);
  }
}

.site-footer {
  padding: 16px 6vw 32px;
  text-align: center;
  font-size: 0.95rem;
}

.site-footer a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  border-bottom: 2px solid rgba(242, 107, 58, 0.5);
}

.site-footer a:hover {
  border-bottom-color: var(--accent);
}

.pinned {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 0 18px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.98), rgba(255, 250, 242, 0.8) 70%, transparent);
  backdrop-filter: blur(6px);
}

.hidden {
  display: none;
}

.pinned__title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 10px;
  color: #6a5f54;
}

.pinned__items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.item {
  background: var(--item-bg, #ffffff);
  border: 1px solid #e6dcc9;
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  min-width: 120px;
  position: relative;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.item:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(242, 107, 58, 0.2);
}

@media (hover: none) {
  .item:hover {
    transform: none;
    border-color: #e6dcc9;
    box-shadow: none;
  }
}

.item:focus,
.item:focus-visible {
  outline: none;
  box-shadow: none;
}

.item.selected {
  border-color: var(--accent);
  background: #ffe6d6;
  box-shadow: 0 0 0 2px rgba(242, 107, 58, 0.35);
}

.item.combined {
  background: var(--item-bg, #fff1dd);
  border-style: dashed;
}

.item.combined::after {
  content: attr(data-full);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: #1c1b1a;
  color: #fffaf2;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.3;
  white-space: pre-wrap;
  max-width: 220px;
  width: max-content;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  z-index: 10;
}

.item.combined:hover::after {
  opacity: 1;
}

.item.complete {
  background: #d9f5d9;
  border-color: #6ac56a;
  box-shadow: 0 0 0 2px rgba(106, 197, 106, 0.35);
}

.item__category {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: #2d6a2d;
}

.item__group {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: #5b554f;
}

.item__count {
  display: none;
  margin-left: 6px;
  font-weight: 700;
  color: #5b554f;
}

@media (max-width: 640px) {
  .item__group {
    display: none;
  }

  .item.combined .item__text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .item.combined .item__count {
    display: inline-block;
  }

  .item.complete .item__text,
  .item.complete .item__count {
    display: none;
  }

}

.item.shake {
  animation: shake 220ms ease-in-out;
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  50% {
    transform: translateX(4px);
  }
  75% {
    transform: translateX(-3px);
  }
  100% {
    transform: translateX(0);
  }
}

footer {
  padding: 10px 6vw 40px;
  font-size: 0.9rem;
  color: #5b554f;
}
