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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --bg-light: #f9fafb;
  --bg-card: #ffffff;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body.dark-mode {
  --bg-gradient: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --border: #374151;
  --bg-light: #1f2937;
  --bg-card: #111827;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--text-primary);
  transition: background 0.3s ease, color 0.3s ease;
}

.container {
  width: 100%;
  max-width: 500px;
  animation: fadeInUp 0.6s ease-out;
}

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

.card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 30px;
  transition: background 0.3s ease;
  position: relative;
}

.header {
  text-align: center;
  margin-bottom: 30px;
  position: relative;
}

.dark-mode-toggle {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--bg-light);
  border: 2px solid var(--border);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.dark-mode-toggle:hover {
  transform: scale(1.05) rotate(10deg);
  border-color: var(--primary);
}

.dark-mode-toggle:active {
  transform: scale(0.95);
}

.dark-mode-toggle .sun-icon {
  display: block;
  color: var(--text-primary);
}

.dark-mode-toggle .moon-icon {
  display: none;
  color: var(--text-primary);
}

body.dark-mode .dark-mode-toggle .sun-icon {
  display: none;
}

body.dark-mode .dark-mode-toggle .moon-icon {
  display: block;
}

.header h1 {
  font-size: 32px;
  font-weight: 700;
  background: var(--bg-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.password-display {
  position: relative;
  margin-bottom: 20px;
}

#passwordOutput {
  width: 100%;
  padding: 18px 60px 18px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-light);
  color: var(--text-primary);
  transition: all 0.3s ease;
  word-break: break-all;
  line-height: 1.4;
}

#passwordOutput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.copy-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.copy-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-50%) scale(1.05);
}

.copy-btn:active {
  transform: translateY(-50%) scale(0.95);
}

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

.strength-indicator {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 30px;
}

.strength-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  width: 50%;
  background: var(--warning);
  border-radius: 10px;
  transition: all 0.4s ease;
}

.strength-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 70px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-header label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.length-value {
  background: var(--bg-gradient);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
}

.slider {
  width: 100%;
  height: 6px;
  border-radius: 10px;
  background: var(--border);
  outline: none;
  -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-gradient);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-gradient);
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 12px;
  border-radius: 10px;
  transition: background 0.3s ease;
  position: relative;
}

.checkbox-label:hover {
  background: var(--bg-light);
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkmark {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked ~ .checkmark {
  background: var(--bg-gradient);
  border-color: transparent;
}

.checkbox-label input[type="checkbox"]:checked ~ .checkmark::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: 700;
}

.checkbox-label span:last-child {
  font-size: 14px;
  color: var(--text-primary);
}

.generate-btn {
  background: var(--bg-gradient);
  color: white;
  border: none;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  margin-top: 10px;
}

.generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.generate-btn:active {
  transform: translateY(0);
}

.generate-btn svg {
  animation: rotate 0.6s ease-in-out;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.tips {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  transition: background 0.3s ease;
}

.tips h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.tips ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tips li {
  font-size: 14px;
  color: var(--text-secondary);
  padding-left: 24px;
  position: relative;
}

.tips li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
}

@media (max-width: 640px) {
  .card {
    padding: 30px 24px;
  }

  .header h1 {
    font-size: 26px;
  }

  #passwordOutput {
    font-size: 16px;
    padding: 16px 55px 16px 16px;
  }
}
