body {
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(to right, #eef2f3, #f5f7fa);
  margin: 0;
  padding: 1rem;
  color: #333;
}

.container {
  max-width: 800px;
  margin: auto;
  padding: 1rem;
}

h1 {
  text-align: center;
  font-size: 2.2rem;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.subtitle {
  text-align: center;
  color: #777;
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  /* Animation for staggered entrance */
}

.floating-letters {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 0;
}
.float-letter {
  position: absolute;
  font-size: 7vw;
  font-weight: bold;
  color: #3498db22;
  opacity: 0.18;
  user-select: none;
  animation: floatLetter 12s infinite linear;
  filter: blur(0.5px);
}
.float-letter:nth-child(1) { left: 10vw; top: 12vh; animation-delay: 0s; }
.float-letter:nth-child(2) { left: 70vw; top: 18vh; animation-delay: 2s; color: #e67e2222; }
.float-letter:nth-child(3) { left: 40vw; top: 60vh; animation-delay: 4s; color: #2ecc7122; }
.float-letter:nth-child(4) { left: 80vw; top: 70vh; animation-delay: 6s; color: #9b59b622; }
.float-letter:nth-child(5) { left: 20vw; top: 80vh; animation-delay: 8s; color: #34495e22; }

@keyframes floatLetter {
  0% { transform: translateY(0) scale(1) rotate(0deg); opacity: 0.18; }
  50% { transform: translateY(-30px) scale(1.08) rotate(8deg); opacity: 0.22; }
  100% { transform: translateY(0) scale(1) rotate(0deg); opacity: 0.18; }
}

.card {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.3rem;
  box-shadow: 0 6px 16px rgba(0,0,0,0.07), 0 0 0 4px #3498db11;
  transition: transform 0.25s cubic-bezier(.4,2,.6,1), box-shadow 0.25s cubic-bezier(.4,2,.6,1), opacity 0.3s;
  cursor: pointer;
  border-left: 6px solid #3498db;
  opacity: 0;
  transform: translateY(30px) scale(0.98);
  animation: cardIn 0.6s cubic-bezier(.4,2,.6,1) forwards;
  border: 2px solid #eaf6fb;
}
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.12s; }
.card:nth-child(3) { animation-delay: 0.19s; }
.card:nth-child(4) { animation-delay: 0.26s; }
.card:nth-child(5) { animation-delay: 0.33s; }
.card:nth-child(6) { animation-delay: 0.40s; }
.card:nth-child(7) { animation-delay: 0.47s; }
.card:nth-child(8) { animation-delay: 0.54s; }

@keyframes cardIn {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 16px 32px rgba(52,152,219,0.13), 0 0 0 6px #3498db22;
  border-left: 8px solid #2980b9;
  border: 2.5px solid #3498db;
}

.card h2 {
  margin: 0;
  font-size: 1.15rem;
  color: #34495e;
}

/* Answer Page */
.answer-card {
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  animation: fadeIn 0.5s ease forwards;
  border-left: 6px solid #27ae60;
}

.answer-card h2 {
  margin-top: 0;
  font-size: 1.4rem;
  color: #2c3e50;
}

.answer-card p {
  font-size: 1.05rem;
  color: #555;
  margin: 1rem 0;
  line-height: 1.6;
}

.back-btn {
  background: #3498db;
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.back-btn:hover {
  background: #2980b9;
}

/* Animation */
@keyframes fadeIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 600px) {
  h1 {
    font-size: 1.6rem;
  }

  .card h2 {
    font-size: 1rem;
  }

  .answer-card h2 {
    font-size: 1.2rem;
  }

  .answer-card p {
    font-size: 1rem;
  }

  .back-btn {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
  }
}
.add-btn {
  display: block;
  margin: 1rem auto;
  padding: 0.6rem 1.2rem;
  background: linear-gradient(90deg, #2ecc71 60%, #27ae60 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(46,204,113,0.10);
  transition: background 0.3s, box-shadow 0.2s, transform 0.2s;
}
.add-btn:hover {
  background: linear-gradient(90deg, #27ae60 60%, #2ecc71 100%);
  box-shadow: 0 6px 18px rgba(39,174,96,0.18);
  transform: translateY(-2px) scale(1.04);
}

.form-container {
  max-width: 600px;
  margin: 1rem auto;
  display: none;
  flex-direction: column;
  gap: 0.8rem;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(52,152,219,0.10), 0 0 0 4px #3498db11;
  padding: 1.2rem 1.5rem;
  opacity: 0;
  transform: translateY(40px) scale(0.98);
  animation: none;
  border: 2px solid #eaf6fb;
}
.form-container[style*="display: flex"] {
  animation: formIn 0.5s cubic-bezier(.4,2,.6,1) forwards;
}
@keyframes formIn {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.form-container input,
.form-container textarea {
  padding: 0.6rem;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  width: 100%;
  transition: border 0.2s, box-shadow 0.2s;
}
.form-container input:focus,
.form-container textarea:focus {
  border: 1.5px solid #3498db;
  box-shadow: 0 2px 8px rgba(52,152,219,0.10);
}

.form-container button {
  padding: 0.6rem 1rem;
  background: linear-gradient(90deg, #3498db 60%, #2980b9 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(52,152,219,0.10);
  transition: background 0.3s, box-shadow 0.2s, transform 0.2s;
}
.form-container button:hover {
  background: linear-gradient(90deg, #2980b9 60%, #3498db 100%);
  box-shadow: 0 6px 18px rgba(52,152,219,0.18);
  transform: translateY(-2px) scale(1.04);
}

.edit-btn, .delete-btn {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 5px;
  font-size: 0.95rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, background 0.2s;
}
.edit-btn::after, .delete-btn::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  background: rgba(255,255,255,0.3);
  border-radius: 100%;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
  z-index: 0;
}
.edit-btn:active::after, .delete-btn:active::after {
  width: 120%;
  height: 300%;
}
.edit-btn {
  background: #f1c40f;
  color: #fff;
  box-shadow: 0 2px 8px rgba(241,196,15,0.08);
}
.edit-btn:hover {
  background: #d4ac0d;
  box-shadow: 0 4px 16px rgba(241,196,15,0.18);
}
.delete-btn {
  background: #e74c3c;
  color: #fff;
  box-shadow: 0 2px 8px rgba(231,76,60,0.08);
}
.delete-btn:hover {
  background: #c0392b;
  box-shadow: 0 4px 16px rgba(231,76,60,0.18);
}
