:root {
  --bg-top: #f6f4d2;
  --bg-bottom: #d3f1df;
  --panel: #fffdf4;
  --ink: #153243;
  --accent: #2c6e49;
  --danger: #a4161a;
  --cat-size: 44px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% -5%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.app-shell {
  width: min(840px, 100%);
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
}

.app-header p {
  margin: 0.35rem 0 0;
  font-size: 1rem;
}

.input-panel,
.list-panel {
  background: var(--panel);
  border: 1px solid rgba(21, 50, 67, 0.14);
  border-radius: 0.85rem;
  padding: 0.9rem;
  box-shadow: 0 8px 20px rgba(21, 50, 67, 0.08);
}

#add-task-form {
  display: flex;
  gap: 0.5rem;
}

#task-input {
  flex: 1;
  border: 1px solid rgba(21, 50, 67, 0.2);
  border-radius: 0.6rem;
  padding: 0.75rem;
  font: inherit;
}

#task-input:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(44, 110, 73, 0.35);
  outline-offset: 1px;
}

button {
  border: 0;
  border-radius: 0.6rem;
  padding: 0.75rem 0.9rem;
  font: inherit;
  font-weight: 650;
  color: #f7fff7;
  background: linear-gradient(135deg, #4c956c, #2c6e49);
}

button:disabled {
  opacity: 0.58;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.panel-title h2 {
  margin: 0;
  font-size: 1.1rem;
}

#active-count {
  min-width: 1.8rem;
  text-align: center;
  border-radius: 999px;
  padding: 0.12rem 0.4rem;
  font-size: 0.85rem;
  background: rgba(44, 110, 73, 0.13);
  color: var(--accent);
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.task-card {
  border: 1px solid rgba(21, 50, 67, 0.16);
  border-radius: 0.65rem;
  background: #fff;
  padding: 0.55rem;
}

.task-card-dead {
  border-color: rgba(164, 22, 26, 0.24);
}

.task-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.task-copy {
  min-width: 0;
  flex: 1;
}

.task-title {
  margin: 0;
  font-size: 1rem;
  word-break: break-word;
}

.task-meta {
  margin: 0.25rem 0 0;
  font-size: 0.86rem;
  opacity: 0.86;
}

.task-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.45rem;
}

.task-actions .ghost {
  background: #f1f5f9;
  color: var(--ink);
}

.task-actions .danger {
  background: #c1121f;
  color: #fff;
}

.cat-sprite {
  width: var(--cat-size);
  height: var(--cat-size);
  flex: 0 0 var(--cat-size);
  background-image: var(--sheet-url);
  background-size: calc(var(--sheet-columns, 1) * var(--cat-size)) var(--cat-size);
  background-repeat: no-repeat;
  background-position: calc(var(--sheet-column, 0) * -1 * var(--cat-size)) 0;
  image-rendering: pixelated;
}

.cat-sprite-scampering {
  animation: scamper-away 2.2s ease-in forwards;
}

@keyframes scamper-away {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(11rem);
    opacity: 0;
  }
}

.list-panel-dead .task-meta {
  color: var(--danger);
  opacity: 1;
}

.link-button {
  border: 0;
  padding: 0;
  font-size: 0.9rem;
  color: var(--danger);
  background: transparent;
}

.empty-state {
  margin: 0.3rem 0 0;
  font-size: 0.92rem;
  opacity: 0.84;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (min-width: 700px) {
  .app-shell {
    padding: 1.5rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-header,
  .input-panel {
    grid-column: 1 / -1;
  }
}
