* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
    color: white;
    padding: 25px 30px;
    text-align: center;
}

h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 16px;
    opacity: 0.9;
}

.content {
    display: flex;
    flex-direction: column;
    padding: 25px;
}

.word-display {
    background-color: #f9fafc;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 25px;
    border: 1px solid #eaeef5;
    text-align: center;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.word {
    font-size: 52px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.definition {
    font-size: 22px;
    color: #34495e;
    line-height: 1.8;
    max-width: 700px;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
}

.control-group {
    background-color: #f8fafd;
    border-radius: 10px;
    padding: 20px;
    flex: 1;
    min-width: 250px;
}

.control-title {
    font-size: 16px;
    color: #4b6cb7;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.control-title i {
    margin-right: 8px;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background-color: #4b6cb7;
    color: white;
}

.btn-primary:hover {
    background-color: #3a5aa0;
}

.btn-secondary {
    background-color: #e8edf7;
    color: #4b6cb7;
}

.btn-secondary:hover {
    background-color: #d9e1f2;
}

.btn-success {
    background-color: #2ecc71;
    color: white;
}

.btn-success:hover {
    background-color: #27ae60;
}

.btn-warning {
    background-color: #f39c12;
    color: white;
}

.btn-warning:hover {
    background-color: #d68910;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.slider-container {
    margin-top: 10px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.slider-value {
    color: #4b6cb7;
    font-weight: 600;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e0e6f0;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #4b6cb7;
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #4b6cb7;
    cursor: pointer;
    border: none;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    background-color: #f8fafd;
    border-radius: 10px;
    padding: 15px 20px;
    margin-top: 10px;
    font-size: 14px;
    color: #555;
}

.current-index {
    color: #4b6cb7;
    font-weight: 600;
}

.progress-container {
    margin-top: 20px;
}

.progress-bar {
    height: 8px;
    background-color: #e0e6f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background-color: #4b6cb7;
    width: 0%;
    transition: width 0.3s;
}

footer {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    font-size: 14px;
    border-top: 1px solid #eee;
}

.speed-display {
    font-size: 18px;
    color: #2c3e50;
    font-weight: 600;
    text-align: center;
    margin-top: 10px;
}

.pronunciation-btn {
    background-color: #9b59b6;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pronunciation-btn:hover {
    background-color: #8e44ad;
}

.active {
    box-shadow: 0 0 0 2px #4b6cb7;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4b6cb7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #666;
    font-size: 16px;
}

.error-message {
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    color: #c62828;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

@media (max-width: 768px) {
    .content {
        padding: 15px;
    }
    
    .word-display {
        padding: 20px;
        min-height: 250px;
    }
    
    .word {
        font-size: 40px;
    }
    
    .definition {
        font-size: 18px;
    }
    
    .control-group {
        min-width: 100%;
    }
}

/* 用户认证相关样式 */

.user-status-bar {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 16px;
  border-radius: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.auth-btn {
  padding: 8px 16px;
  background: #4b6cb7;
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
}

.auth-btn:hover {
  background: #3a5aa0;
  transform: translateY(-1px);
}

#user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

#username-display {
  font-weight: 600;
  color: #333;
}

/* 模态框样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { 
    opacity: 0;
    transform: translateY(-20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #eee;
}

.modal-header h2 {
  margin: 0;
  color: #333;
  font-size: 24px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s;
}

.close-btn:hover {
  background: #f5f5f5;
  color: #666;
}

/* 认证表单样式 */
.auth-container {
  padding: 25px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  position: relative;
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e0e6f0;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.3s;
  outline: none;
}

.form-group input:focus {
  border-color: #4b6cb7;
  box-shadow: 0 0 0 3px rgba(75, 108, 183, 0.1);
}

.form-group input::placeholder {
  color: #999;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #666;
}

.remember-me input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.auth-form button[type="submit"] {
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
}

.auth-switch {
  text-align: center;
  margin: 0;
  color: #666;
  font-size: 14px;
}

.auth-switch a {
  color: #4b6cb7;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s;
}

.auth-switch a:hover {
  color: #3a5aa0;
  text-decoration: underline;
}

.auth-message {
  padding: 0 25px 25px;
  text-align: center;
  font-size: 14px;
  min-height: 20px;
}

.auth-message.success {
  color: #27ae60;
}

.auth-message.error {
  color: #e74c3c;
}

/* 用户统计面板样式 */
.user-stats-panel {
  position: fixed;
  top: 80px;
  right: 20px;
  background: rgba(255, 255, 255, 0.95);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  z-index: 999;
  width: 250px;
  border: 1px solid #eaeef5;
}

.user-stats-panel h3 {
  margin: 0 0 15px 0;
  color: #2c3e50;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-label {
  color: #666;
  font-size: 14px;
}

.stat-value {
  color: #4b6cb7;
  font-size: 20px;
  font-weight: 700;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .user-status-bar {
    top: 10px;
    right: 10px;
    padding: 6px 12px;
  }
  
  .auth-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .user-stats-panel {
    top: 60px;
    right: 10px;
    width: calc(100% - 20px);
    max-width: 300px;
  }
  
  .modal-content {
    width: 95%;
    margin: 10px;
  }
}

/* 收藏按钮样式 */
.favorite-btn {
  animation: none;
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  20%, 60% { transform: rotate(10deg); }
  40%, 80% { transform: rotate(-10deg); }
}

/* 收藏弹窗样式 */
.collection-list {
  max-height: 300px;
  overflow-y: auto;
  margin: 20px 0;
  border: 1px solid #e0e6f0;
  border-radius: 8px;
  padding: 10px;
}

.collection-item {
  padding: 10px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
}

.collection-item:last-child {
  border-bottom: none;
}

.collection-item input[type="checkbox"] {
  margin-right: 10px;
}

.collection-name {
  font-weight: 600;
  color: #333;
}

.default-badge {
  background-color: #4b6cb7;
  color: white;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 8px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* 词库选择弹窗样式 */
.vocabulary-tabs {
  display: flex;
  border-bottom: 1px solid #e0e6f0;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 16px;
  color: #666;
  cursor: pointer;
  transition: all 0.3s;
}

.tab-btn:hover {
  color: #4b6cb7;
}

.tab-btn.active {
  color: #4b6cb7;
  border-bottom-color: #4b6cb7;
  font-weight: 600;
}

.vocabulary-list {
  max-height: 400px;
  overflow-y: auto;
}

.vocabulary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border: 1px solid #e0e6f0;
  border-radius: 8px;
  margin-bottom: 10px;
  transition: all 0.3s;
}

.vocabulary-item:hover {
  border-color: #4b6cb7;
  box-shadow: 0 2px 8px rgba(75, 108, 183, 0.1);
}

.vocab-info h4 {
  margin: 0 0 5px 0;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vocab-info p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.vocab-actions {
  display: flex;
  gap: 8px;
}

.no-data {
  text-align: center;
  color: #999;
  padding: 40px 0;
  font-style: italic;
}

/* 使所有弹窗居中 */
.modal-content {
  position: relative;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .vocabulary-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .vocab-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .modal-actions {
    flex-direction: column;
  }
  
  .modal-actions .btn {
    width: 100%;
  }
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  20%, 60% { transform: rotate(10deg); }
  40%, 80% { transform: rotate(-10deg); }
}

/* 收藏按钮样式 */
.favorite-btn {
  animation: none;
  transition: color 0.3s, transform 0.3s;
  cursor: pointer;
}

.favorite-btn:hover {
  transform: scale(1.1);
}

.favorite-btn.shaking {
  animation: shake 0.5s ease-in-out;
}

/* 已收藏状态 */
.favorite-btn.favorited {
  color: #ffd700 !important; /* 金色 */
}

/* 未收藏状态 */
.favorite-btn:not(.favorited) {
  color: #ccc !important; /* 灰色 */
}

/* 收藏按钮基础样式 */
.favorite-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  color: #ccc;
}

/* 鼠标悬停效果 - 轻微放大和颜色变化 */
.favorite-btn:hover {
  transform: scale(1.15);
  color: #ffcc00;
}   

/* 长按时的持续抖动效果 - 类似B站三连 */
@keyframes bilibili-shake {
  0%, 100% { 
    transform: scale(1.1) rotate(0deg); 
  }
  20%, 60% { 
    transform: scale(1.1) rotate(8deg); 
  }
  40%, 80% { 
    transform: scale(1.1) rotate(-8deg); 
  }
}

.favorite-btn.long-pressing {
  animation: bilibili-shake 0.5s ease-in-out infinite;
  color: #ff9800 !important; /* 长按时变橙色 */
}

/* 收藏状态 - 已收藏的星星 */
.favorite-btn.favorited {
  color: #ffd700 !important; /* 金色 */
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.favorite-btn.favorited:hover {
  color: #ffed4e !important;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
}

/* 点击收藏时的庆祝动画 */
@keyframes celebrate {
  0% { 
    transform: scale(1); 
  }
  25% { 
    transform: scale(1.3) rotate(10deg); 
  }
  50% { 
    transform: scale(1.1) rotate(-10deg); 
  }
  75% { 
    transform: scale(1.2) rotate(5deg); 
  }
  100% { 
    transform: scale(1); 
  }
}

.favorite-btn.celebrate {
  animation: celebrate 0.6s ease-out;
}