* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --gradient-start: #1a1a2e;
  --gradient-mid: #16213e;
  --gradient-end: #0f3460;
  --accent-coral: #e94560;
  --accent-teal: #0ead69;
  --accent-gold: #f4d35e;
  --card-bg: #1e1e2f;
  --card-border: #2d2d44;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b8;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-mid) 50%, var(--gradient-end) 100%);
  min-height: 100vh;
  color: var(--text-primary);
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: linear-gradient(135deg, #e94560 0%, #ff6b6b 50%, #feca57 100%);
  padding: 2rem 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.3;
}

.title {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 800;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
  letter-spacing: -1px;
}

.tagline {
  font-size: clamp(0.9rem, 2.5vw, 1.2rem);
  font-weight: 500;
  opacity: 0.95;
  margin-top: 0.5rem;
  position: relative;
  z-index: 1;
  font-style: italic;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* Filters */
.filters-section {
  margin-bottom: 2rem;
}

.filters-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.filter-chip {
  font-family: 'Space Grotesk', sans-serif;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  border: 2px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  border-color: var(--accent-coral);
  color: var(--text-primary);
}

.filter-chip.active {
  background: linear-gradient(135deg, var(--accent-coral), #ff6b6b);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

/* Problem Card */
.problem-card {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 1.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  transition: all 0.3s ease;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.problem-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

.problem-card.daily {
  border-color: var(--accent-gold);
  background: linear-gradient(135deg, rgba(244, 211, 94, 0.1) 0%, var(--card-bg) 100%);
}

.problem-card.animating {
  animation: cardFlip 0.3s ease;
}

@keyframes cardFlip {
  0% { transform: scale(1) rotateY(0); opacity: 1; }
  50% { transform: scale(0.95) rotateY(90deg); opacity: 0.5; }
  100% { transform: scale(1) rotateY(0); opacity: 1; }
}

.daily-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent-gold), #ffa502);
  color: #1a1a2e;
  padding: 0.4rem 1rem;
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.category-badge {
  display: inline-block;
  background: rgba(233, 69, 96, 0.2);
  color: var(--accent-coral);
  padding: 0.3rem 0.8rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.problem-text {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.problem-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--card-border);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.meta-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  font-weight: 600;
}

.meta-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: var(--accent-teal);
  font-weight: 600;
}

.popularity-bar {
  width: 100px;
  height: 6px;
  background: var(--card-border);
  border-radius: 3px;
  overflow: hidden;
}

.popularity-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-coral), var(--accent-gold));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.strawberries {
  font-size: 1rem;
  letter-spacing: 2px;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--card-border);
}

.action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  padding: 0.5rem 0.8rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.action-btn.active {
  background: rgba(233, 69, 96, 0.2);
  border-color: var(--accent-coral);
}

.action-btn.twitter {
  font-weight: 700;
  font-size: 0.85rem;
}

/* Generate Button */
.generate-btn {
  font-family: 'Space Grotesk', sans-serif;
  width: 100%;
  max-width: 400px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-coral) 0%, #ff6b6b 100%);
  border: none;
  border-radius: 1rem;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 30px rgba(233, 69, 96, 0.4);
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 40px rgba(233, 69, 96, 0.5);
}

.generate-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.generate-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-icon {
  font-size: 1.4rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* History Toggle */
.history-toggle {
  font-family: 'Space Grotesk', sans-serif;
  display: block;
  margin: 0 auto 1.5rem;
  padding: 0.6rem 1.2rem;
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 0.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.history-toggle:hover {
  border-color: var(--accent-coral);
  color: var(--text-primary);
}

/* History Section */
.history-section,
.favorites-section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.history-title,
.favorites-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.section-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 1rem;
}

.history-list,
.favorites-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item,
.favorite-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-item:hover,
.favorite-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.history-badge,
.favorite-badge {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.history-text,
.favorite-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-favorite {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.2s ease;
  padding: 0 0.5rem;
}

.remove-favorite:hover {
  opacity: 1;
  color: var(--accent-coral);
}

/* Daily Section */
.daily-section {
  margin-bottom: 2rem;
}

.generated-section {
  margin-bottom: 1.5rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--card-border);
}

.footer p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.footer a {
  color: var(--accent-coral);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: #ff6b6b;
}

.footer-joke {
  font-size: 0.75rem;
  margin-top: 0.5rem;
  opacity: 0.6;
  font-style: italic;
}

/* Confetti */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -20px;
  animation: fall 2s linear forwards;
}

@keyframes fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Responsive */
@media (max-width: 640px) {
  .header {
    padding: 1.5rem 1rem;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  .problem-card {
    padding: 1.25rem;
  }
  
  .filter-chip {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
  }
  
  .card-actions {
    justify-content: center;
  }
  
  .problem-meta {
    flex-direction: column;
    gap: 1rem;
  }
}