:root {
  --ink: #171717;
  --paper: #f8f4ef;
  --accent: #e4572e;
  --accent-strong: #b23c1f;
  --sky: #f2fbff;
  --forest: #0f4c4c;
  --muted: #665c54;
  --card: #ffffff;
  --border: rgba(23, 23, 23, 0.12);
  --shadow: 0 18px 40px rgb(0 151 167 / 19%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(
    circle at top left,
    #f9efd5 0%,
    #ffffff 45%,
    #d0edf7 100%
  );
  min-height: 100vh;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 72px;
}

header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 32px;
  animation: fadeIn 0.8s ease;
}

header h1 {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-size: clamp(2rem, 3vw, 2.8rem);
  letter-spacing: -0.02em;
  color: var(--forest);
}

header p {
  margin: 0;
  max-width: 620px;
  color: var(--muted);
}

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

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: riseIn 0.7s ease;
}

.card::before {
  content: '';
  position: absolute;
  inset: -30% auto auto -20%;
  width: 180px;
  height: 180px;
  background: rgba(228, 87, 46, 0.08);
  border-radius: 50%;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.2rem;
}

#tasks {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.task {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fffaf2;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  animation: fadeIn 0.4s ease;
}

.task.done {
  background: #edf7f1;
  color: #37685d;
  text-decoration: line-through;
}

.task-id {
  font-size: 0.75rem;
  color: var(--muted);
}

.chat-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

#messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  padding-right: 6px;
}

.bubble {
  padding: 12px 14px;
  border-radius: 16px;
  max-width: 85%;
  line-height: 1.4;
  animation: fadeIn 0.3s ease;
}

.bubble.user {
  background: #ffe7da;
  align-self: flex-end;
}

.bubble.assistant {
  background: var(--sky);
  align-self: flex-start;
}

form {
  display: flex;
  gap: 12px;
}

textarea {
  flex: 1;
  min-height: 64px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  font-family: inherit;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 1rem;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.status {
  font-size: 0.85rem;
  color: var(--muted);
}

.mt-10 {
  margin-top: 10px;
}

.links {
  margin-top: 18px;
  font-size: 0.85rem;
}

.links a {
  color: var(--forest);
  text-decoration: underline;
  text-underline-offset: 5px;
}

.links a[target='_blank']::after {
  content: '↗';
  display: inline-block;
  margin-left: 0.3em;
  font-size: 0.875rem;
  line-height: 1;
}

.links a:hover {
  border-color: var(--forest);
  text-decoration: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 720px) {
  .page {
    padding: 32px 18px 60px;
  }

  form {
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}
