* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --bg-color: #f9fafb;
  --container-bg: #ffffff;
  --text-color: #1f2937;
  --border-color: #e5e7eb;
  --success-color: #10b981;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.container {
  background-color: var(--container-bg);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 500px;
  padding: 30px;
}

.header {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin-bottom: 30px;
}

h1 {
  text-align: center;
  font-size: 28px;
  font-weight: 600;
  color: var(--primary-color);
}

.github-link {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
}

.github-link a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--bg-color);
  color: var(--text-color);
  border-radius: 50%;
  text-decoration: none;
  transition: all 0.3s;
}

.github-link a:hover {
  background-color: #e5e7eb;
  color: var(--primary-color);
  transform: rotate(10deg);
}

.github-link svg {
  width: 24px;
  height: 24px;
}

.password-container {
  position: relative;
  margin-bottom: 30px;
}

#password {
  width: 100%;
  height: 56px;
  background-color: var(--bg-color);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 0 50px 0 15px;
  font-size: 18px;
  color: var(--text-color);
  letter-spacing: 1px;
  transition: all 0.3s;
}

#password:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

#copy-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-color);
  opacity: 0.5;
  transition: all 0.3s;
}

#copy-btn:hover {
  opacity: 1;
  color: var(--primary-color);
}

.options {
  margin-bottom: 30px;
}

.option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.length-container {
  display: flex;
  align-items: center;
}

#length {
  width: 200px;
  margin-right: 10px;
  accent-color: var(--primary-color);
}

#length-value {
  min-width: 30px;
  text-align: center;
  font-weight: 600;
}

/* 开关样式 */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

#generate-btn {
  display: block;
  width: 100%;
  height: 50px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

#generate-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

#generate-btn:active {
  transform: translateY(0);
}

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background-color: var(--success-color);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 576px) {
  .container {
    padding: 20px;
  }
  
  #length {
    width: 150px;
  }
}

/* 历史密码相关样式 */
.history-container {
  margin-top: 30px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: none;
}

.history-container.active {
  display: block;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.history-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color);
}

#clear-history {
  background: none;
  border: none;
  color: var(--primary-color);
  font-size: 14px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 4px;
  transition: all 0.3s;
}

#clear-history:hover {
  background-color: rgba(99, 102, 241, 0.1);
}

.password-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 200px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background-color: var(--bg-color);
  border-radius: 8px;
  transition: all 0.3s;
}

.history-item:hover {
  background-color: rgba(99, 102, 241, 0.05);
}

.history-password {
  font-family: monospace;
  letter-spacing: 1px;
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 10px;
}

.history-actions {
  display: flex;
  gap: 5px;
}

.history-copy, .history-delete {
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.3s;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.history-copy:hover, .history-delete:hover {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.05);
}

.history-timestamp {
  font-size: 12px;
  color: #6b7280;
  margin-top: 3px;
} 