:root {
  --primary: #5b4fb5;
  --secondary: #8b7fd4;
  --success: #4caf50;
  --background: #f8f9fa;
  --text: #333;
  --border: #e0e0e0;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--text);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  padding: 40px;
}

h1 {
  text-align: center;
  color: var(--primary);
  margin-bottom: 10px;
  font-size: 2.2rem;
}

.controls {
  display: flex;
  gap: 15px;
  margin: 30px 0;
  flex-wrap: wrap;
}

input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 12px 15px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 79, 181, 0.1);
}

button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

button:hover {
  background: var(--secondary);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(91, 79, 181, 0.4);
}

button:active {
  transform: translateY(0);
}

.habits-list {
  list-style: none;
  margin-top: 30px;
}

.habit-item {
  background: var(--background);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 15px;
  border-left: 4px solid var(--primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.habit-info {
  flex: 1;
}

.habit-name {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 5px;
}

.habit-streak {
  color: var(--success);
  font-weight: 600;
  font-size: 0.9rem;
}

.habit-actions {
  display: flex;
  gap: 10px;
}

.habit-btn {
  padding: 8px 16px;
  font-size: 0.9rem;
  border-radius: 6px;
}

.mark-btn {
  background: var(--success);
}

.mark-btn:hover {
  background: #45a049;
}

.delete-btn {
  background: #ff6b6b;
}

.delete-btn:hover {
  background: #ff5252;
}

.calendar-view {
  margin-top: 30px;
  padding: 20px;
  background: var(--background);
  border-radius: 8px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 15px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.completed {
  background: var(--success);
  color: white;
}

.missed {
  background: #ffebee;
  color: #c62828;
}

@media (max-width: 600px) {
  .container {
    padding: 20px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .controls {
    flex-direction: column;
  }

  input[type="text"] {
    min-width: auto;
  }

  .habit-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .habit-actions {
    margin-top: 15px;
    width: 100%;
  }

  .habit-btn {
    flex: 1;
  }
}
