/* ========== 全局样式 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== 登录页面 ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
}
.login-box {
  background: white;
  border-radius: 20px;
  padding: 30px 25px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.logo {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));

  font-size: 50px;
  text-align: center;
  margin-bottom: 5px;
}
.login-box h1 {
  text-align: center;
  color: #667eea;
  margin-bottom: 20px;
  font-size: 22px;
}
.tabs {
  display: flex;
  margin-bottom: 20px;
  border-radius: 12px;
  overflow: hidden;
  background: #f0f0f0;
}
.tab {
  flex: 1;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}
.tab.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}
.form-group {
  margin-bottom: 15px;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #333;
}
.form-group input {
  width: 100%;
  padding: 14px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 16px;
  transition: border-color 0.3s;
}
.form-group input:focus {
  outline: none;
  border-color: #667eea;
}
.btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}
.btn:active {
  transform: translateY(0);
}
.btn-sm {
  padding: 10px 20px;
  font-size: 14px;
  width: auto;
}
.btn-success {
  background: linear-gradient(135deg, #27ae60, #229954);
}
.error {
  color: #e74c3c;
  text-align: center;
  margin-bottom: 15px;
  display: none;
  font-size: 14px;
}
.hidden {
  display: none !important;
}

/* ========== 主页面 - 移动端优先 ========== */
.main-page {
  min-height: 100vh;
  height: auto; /* 内容多时自动撑开 */
  padding: 10px;
  max-width: 1200px;
  margin: 0 auto;
}
.header {
  background: white;
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  gap: 10px;
  flex-wrap: wrap;
}
.header-info h1 {
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.header-info p {
  font-size: 13px;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
}
.header-btns {
  display: flex;
  gap: 8px;
}
.header-btns button {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: #667eea;
  color: white;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.profile-btn {
  background: linear-gradient(135deg, #667eea, #764ba2) !important;
}
.header-btns button:hover {
  opacity: 0.9;
}

/* 星星显示 */
.stars-display {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.95) !important;
  color: #92400e !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
  gap: 5px;
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s;
  margin-right: 10px;
}
.membership-badge {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.95) !important;
  color: #333 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s;
  white-space: nowrap;
}
.membership-badge:hover {
  transform: scale(1.05);
}
.stars-display:hover {
  transform: scale(1.05);
}
.star-icon {
  font-size: 18px;
}
.star-count {
  font-size: 16px;
  color: #333;
  min-width: 20px;
  text-align: center;
}

/* 签到按钮 */
.checkin-display {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.95) !important;
  color: #16a34a !important;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 700 !important;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
  margin-right: 10px;
}
.checkin-display:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}
.checkin-display.checked {
  background: rgba(255,255,255,0.95) !important;
  color: #16a34a !important;
  font-weight: 700 !important;
}
.pet-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: 10px;
}
.pet-display:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}
.pet-emoji {
  font-size: 28px;
}
.pet-status-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: white;
}
.pet-hunger, .pet-happiness {
  white-space: nowrap;
}
.checkin-icon {
  font-size: 16px;
}
.checkin-text {
  font-size: 14px;
}
.checkin-streak {
  font-size: 12px;
  background: rgba(255,255,255,0.2);
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 3px;
}

/* 星星流水弹窗 */
.star-history-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  z-index: 2000;
  min-width: 350px;
  max-width: 90vw;
  max-height: 500px;
  overflow: hidden;
}
.star-history-modal h3 {
  margin: 0 0 15px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #333;
}
.history-list {
  max-height: 350px;
  overflow-y: auto;
}
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #eee;
}
.history-item:last-child {
  border-bottom: none;
}
.history-item.earn {
  color: #22c55e;
}
.history-item.spend {
  color: #ef4444;
}
.history-time {
  color: #999;
  font-size: 12px;
  margin-top: 4px;
}
.history-amount {
  font-weight: bold;
  font-size: 18px;
}

/* 侧边栏 - 移动端 */
.sidebar {
  background: white;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 10px;
}
.sidebar h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #667eea;
}
.lesson-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 5px;
}
.lesson-item {
  background: #f8f9fa;
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
}
.lesson-item:hover {
  background: #e9ecef;
  transform: translateY(-2px);
}
.lesson-item.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}
.lesson-item .stars {
  font-size: 12px;
  margin-top: 4px;
}

/* 主内容区 - 移动端 */
.main-content {
  background: white;
  border-radius: 16px;
  padding: 16px;
  height: auto; /* 内容多时自动撑开 */
  min-height: 500px;
}
.empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}
.empty-icon {
  font-size: 60px;
  margin-bottom: 10px;
}

/* 课程内容 */
.task-section {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 15px;
}
.task-section h2 {
  font-size: 16px;
  margin-bottom: 8px;
  color: #667eea;
}
.task-section p {
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

/* 选择题 */
.choices-title {
  font-size: 15px;
  font-weight: 600;
  margin: 15px 0 10px;
  color: #333;
}
.choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.choice {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}
.choice:hover {
  border-color: #667eea;
  transform: translateX(4px);
}
.choice.selected {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}
.choice.correct {
  border-color: #27ae60;
  background: rgba(39, 174, 96, 0.1);
}
.choice.wrong {
  border-color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
  animation: shake 0.5s;
}
.choice code {
  display: inline-block;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  background: #1e1e1e;
  color: #0f0;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  margin-right: 10px;
  min-width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.choice p {
  font-size: 12px;
  color: #666;
  margin: 0;
}
/* 选项中的代码标签 */
.choice-label {
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 13px;
  color: #2d3436;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
  flex: 1;
}
.choice-label code {
  background: none;
  padding: 0;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
}

/* 选项行：code + label 同行显示 */
.choice-row {
  display: flex;
  align-items: center;
  gap: 0;
}

/* 选项解析（答错后显示） */
.choice-analysis {
  display: block;
  margin-top: 8px;
  padding: 8px 10px;
  background: #fff3cd;
  border-radius: 6px;
  font-size: 12px;
  color: #856404;
  border-left: 3px solid #ffc107;
}


/* 代码编辑器 */
#editor {
  height: 250px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
}

/* stdin输入框 */
#stdinBox {
  display: none;
  margin: 10px 0;
}
#stdinBox label {
  font-size: 13px;
  color: #666;
  display: block;
  margin-bottom: 5px;
}
#stdin {
  width: 100%;
  height: 50px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: monospace;
  font-size: 12px;
  resize: vertical;
}

/* 按钮组 */
.btns {
  display: flex;
  gap: 10px;
  margin: 15px 0;
}
.run-btn, .submit-btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.run-btn {
  background: #3498db;
  color: white;
}
.submit-btn {
  background: linear-gradient(135deg, #27ae60, #229954);
  color: white;
}
.run-btn:hover, .submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 输出区域 */
.output {
  background: #1e1e1e;
  color: #0f0;
  padding: 12px;
  border-radius: 12px;
  font-family: monospace;
  font-size: 13px;
  min-height: 80px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 12px;
  margin-top: 15px;
  flex-wrap: wrap;
}
.pagination-info {
  font-size: 13px;
  color: #666;
}
.pagination-btns {
  display: flex;
  gap: 10px;
}
.pagination-btns button {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.pagination-btns button:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}
.pagination-btns button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 弹窗层 */
.result-overlay, .profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000 !important;
  padding: 20px;
  min-height: 100vh;
  width: 100%;
}
.result-card, .profile-card {
  background: white;
  border-radius: 20px;
  padding: 30px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  max-height: 80vh;
  overflow-y: auto;
}
.result-icon {
  font-size: 60px;
  margin-bottom: 15px;
}
.result-text {
  font-size: 18px;
  margin-bottom: 20px;
  color: #333;
}
.profile-header {
  margin-bottom: 20px;
}
.profile-avatar {
  font-size: 50px;
  margin-bottom: 10px;
}
.profile-name {
  font-size: 20px;
  font-weight: 600;
  color: #667eea;
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin: 20px 0;
}
.stat-item {
  padding: 15px;
  background: #f8f9fa;
  border-radius: 12px;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #667eea;
}
.stat-label {
  font-size: 12px;
  color: #666;
  margin-top: 5px;
}
.profile-section {
  text-align: left;
  margin: 20px 0;
}
.profile-section h3 {
  font-size: 16px;
  color: #667eea;
  margin-bottom: 10px;
}
.lesson-progress-item {
  padding: 10px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

/* 动画 */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* ========== 会员中心样式 ========== */
.membership-modal-header {
  text-align: center;
  padding: 35px 25px 25px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 24px 24px 0 0;
  color: white;
}

.membership-modal-icon {
  font-size: 64px;
  margin-bottom: 15px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
  animation: bounce 1s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.membership-modal-title {
  margin: 0;
  font-size: 26px;
  font-weight: bold;
}

.membership-modal-expire {
  margin: 12px 0 0;
  opacity: 0.9;
  font-size: 15px;
}

.membership-benefits-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 24px;
}

.membership-benefits-title {
  font-size: 18px;
  margin: 0 0 16px;
  color: #333;
  display: flex;
  align-items: center;
  font-weight: 600;
}

.membership-benefit-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #dee2e6;
  transition: all 0.2s;
}

.membership-benefit-item:hover {
  background: rgba(102, 126, 234, 0.05);
  padding-left: 8px;
}

.membership-benefit-item:last-child {
  border-bottom: none;
}

.membership-benefit-icon {
  font-size: 22px;
  margin-right: 14px;
  min-width: 28px;
}

.membership-benefit-text {
  flex: 1;
  font-size: 15px;
  color: #555;
}

.membership-benefit-status {
  margin-left: auto;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: bold;
}

.membership-benefit-status.unlocked {
  background: #d4edda;
  color: #27ae60;
}

.membership-benefit-status.locked {
  background: #f8d7da;
  color: #e74c3c;
}

.membership-plans-title {
  font-size: 18px;
  margin: 0 0 16px;
  color: #333;
  display: flex;
  align-items: center;
  font-weight: 600;
}

.membership-plans-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.membership-plan-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 16px;
  padding: 22px;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.membership-plan-card:hover {
  border-color: #667eea;
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(102, 126, 234, 0.25);
}

.membership-plan-card:active {
  transform: translateY(-2px);
}

.membership-plan-card .plan-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.membership-plan-card .plan-name {
  font-weight: bold;
  margin-bottom: 12px;
  font-size: 17px;
  color: #333;
}

.membership-plan-card .plan-price {
  color: #e74c3c;
  font-size: 28px;
  font-weight: bold;
}

.plan-original-price {
  color: #999;
  font-size: 13px;
  text-decoration: line-through;
  margin-top: 6px;
}

.membership-plan-card .plan-duration {
  color: #666;
  font-size: 13px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.membership-close-btn {
  width: 100%;
  padding: 16px;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 24px;
  font-size: 17px;
  font-weight: bold;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.membership-close-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

/* ========== 平板适配 (768px - 1023px) ========== */
@media (min-width: 768px) and (max-width: 1023px) {
  .membership-modal-header {
    padding: 30px 20px 20px;
  }
  
  .membership-modal-icon {
    font-size: 56px;
  }
  
  .membership-modal-title {
    font-size: 24px;
  }
  
  .membership-benefits-card {
    padding: 20px;
  }
  
  .membership-benefit-item {
    padding: 8px 0;
  }
  
  .membership-plans-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .membership-plan-card {
    padding: 18px;
  }
  
  .membership-plan-card .plan-icon {
    font-size: 36px;
  }
  
  .membership-plan-card .plan-price {
    font-size: 24px;
  }
}

/* ========== 手机适配 (< 768px) ========== */
@media (max-width: 767px) {
  .membership-modal-header {
    padding: 25px 15px 18px;
  }
  
  .membership-modal-icon {
    font-size: 48px;
  }
  
  .membership-modal-title {
    font-size: 22px;
  }
  
  .membership-modal-expire {
    font-size: 13px;
  }
  
  .membership-benefits-card {
    padding: 16px;
    border-radius: 12px;
  }
  
  .membership-benefits-title {
    font-size: 16px;
  }
  
  .membership-benefit-item {
    padding: 6px 0;
    font-size: 14px;
  }
  
  .membership-benefit-icon {
    font-size: 20px;
    margin-right: 10px;
  }
  
  .membership-benefit-text {
    font-size: 13px;
  }
  
  .membership-benefit-status {
    font-size: 11px;
    padding: 3px 10px;
  }
  
  .membership-plans-title {
    font-size: 16px;
  }
  
  .membership-plans-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  
  .membership-plan-card {
    padding: 16px;
    border-radius: 14px;
  }
  
  .membership-plan-card .plan-icon {
    font-size: 32px;
    margin-bottom: 8px;
  }
  
  .membership-plan-card .plan-name {
    font-size: 14px;
    margin-bottom: 8px;
  }
  
  .membership-plan-card .plan-price {
    font-size: 22px;
  }
  
  .plan-original-price {
    font-size: 12px;
  }
  
  .membership-plan-card .plan-duration {
    font-size: 12px;
    margin-top: 8px;
    padding-top: 8px;
  }
  
  .membership-close-btn {
    padding: 14px;
    font-size: 16px;
    margin-top: 20px;
  }
}

/* ========== 小屏手机优化 (< 480px) ========== */
@media (max-width: 480px) {
  .header {
    padding: 10px 12px;
    border-radius: 12px;
  }

  .header-info h1 {
    font-size: 15px;
  }

  .header-info p {
    font-size: 11px;
  }

  /* 功能按钮更紧凑 */
  .membership-badge {
    font-size: 10px;
    padding: 5px 8px;
  }

  .stars-display, .checkin-display {
    padding: 6px 10px;
    font-size: 12px;
    margin-right: 4px;
  }

  .star-icon, .checkin-icon {
    font-size: 13px;
  }

  .star-count, .checkin-text {
    font-size: 12px;
  }

  .header-btns {
    margin-top: 6px;
    padding-top: 6px;
    gap: 6px;
  }

  .header-btns button {
    padding: 10px 8px;
    font-size: 13px;
  }

  /* 会员中心弹窗优化 */
  .membership-plans-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .membership-plan-card {
    padding: 14px;
  }

  .membership-plan-card .plan-icon {
    font-size: 28px;
    margin-bottom: 6px;
  }

  .membership-plan-card .plan-name {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .membership-plan-card .plan-price {
    font-size: 20px;
  }
}

/* ========== 电脑适配 (≥1024px) ========== */
@media (min-width: 1024px) {
  .main-page {
    max-width: 1200px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    padding: 20px;
  }
  .header {
    grid-column: 1 / -1;
    padding: 16px 24px;
  }
  .header-info h1 {
    font-size: 22px;
  }
  .header-info p {
    font-size: 14px;
  }
  .sidebar {
    margin-bottom: 0;
    position: sticky;
    top: 20px;
    height: fit-content;
  }
  .sidebar h2 {
    font-size: 18px;
    margin-bottom: 15px;
  }
  .lesson-list {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 200px);
  }
  .lesson-item {
    font-size: 14px;
    padding: 14px;
  }
  .main-content {
    min-height: calc(100vh - 150px);
    height: auto; /* 内容多时自动撑开 */
    overflow: visible;
  }
  .task-section {
    padding: 20px;
  }
  .task-section h2 {
    font-size: 20px;
  }
  .task-section p {
    font-size: 15px;
  }
  #editor {
    height: 320px;
  }
  .btns {
    gap: 15px;
  }
  .run-btn, .submit-btn {
    padding: 16px;
    font-size: 17px;
  }
  .output {
    font-size: 14px;
    padding: 15px;
  }
  .profile-card {
    max-width: 500px;
    padding: 40px;
  }
  .profile-stats {
    gap: 25px;
  }
  .stat-item {
    padding: 20px;
  }
  .stat-value {
    font-size: 32px;
  }
  .stat-label {
    font-size: 13px;
  }
}

/* ========== 大屏电脑 (≥1440px) ========== */
@media (min-width: 1440px) {
  .main-page {
    max-width: 1400px;
    grid-template-columns: 320px 1fr;
    gap: 25px;
  }
  .lesson-item {
    font-size: 15px;
  }
  #editor {
    height: 380px;
  }
}

/* ========== 滚动条美化 ========== */
.lesson-list::-webkit-scrollbar,
.profile-card::-webkit-scrollbar {
  width: 6px;
}
.lesson-list::-webkit-scrollbar-track,
.profile-card::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}
.lesson-list::-webkit-scrollbar-thumb,
.profile-card::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 3px;
}
.lesson-list::-webkit-scrollbar-thumb:hover,
.profile-card::-webkit-scrollbar-thumb:hover {
  background: #764ba2;
}

/* ========== 课程列表切换按钮（手机端） ========== */
.menu-toggle {
  display: none;
  padding: 8px 12px;
  border: none;
  background: #667eea;
  color: white;
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  margin-right: 10px;
}

.close-sidebar {
  display: none;
  padding: 5px 10px;
  border: none;
  background: #e74c3c;
  color: white;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s;
}

/* ========== 手机端适配 (< 768px) ========== */
@media (max-width: 767px) {
  .menu-toggle {
    display: block;
  }

  .main-page {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    width: 280px;
    height: 100vh;
    z-index: 999;
    margin: 0;
    border-radius: 0;
    padding: 20px;
    transition: left 0.3s ease;
    overflow-y: auto;
  }

  .sidebar.active {
    left: 0;
  }

  .close-sidebar {
    display: block;
  }

  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }

  .lesson-list {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 150px);
  }

  .header {
    padding: 12px 15px;
    flex-wrap: wrap;
    gap: 10px;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  }

  .menu-toggle {
    order: 1;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
  }

  .header-info {
    order: 2;
    flex: 1;
    min-width: 0;
  }

  .header-info h1 {
    font-size: 16px;
    font-weight: 600;
  }

  .header-info p {
    font-size: 12px;
    color: #666;
  }

  /* 功能按钮容器 */
  .membership-badge {
    order: 3;
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 16px;
    white-space: nowrap;
  }

  .stars-display, .checkin-display {
    order: 3;
    padding: 7px 12px;
    font-size: 13px;
    margin-right: 6px;
    border-radius: 16px;
  }

  .stars-display {
    margin-right: 6px;
  }

  .checkin-display {
    margin-right: 0;
  }

  .star-icon, .checkin-icon {
    font-size: 14px;
  }

  .checkin-streak {
    display: none !important;
  }

  /* 操作按钮 */
  .header-btns {
    order: 4;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
  }

  .header-btns button {
    padding: 12px 10px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s;
  }

  .profile-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
  }

  .header-btns button:last-child {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e0e0e0;
  }

  .header-btns button:active {
    transform: scale(0.98);
  }

  .main-content {
    padding: 15px;
    min-height: calc(100vh - 180px);
    height: auto; /* 内容多时自动撑开 */
    overflow: visible;
  }

  #editor {
    height: 300px;
  }

  .btns {
    flex-direction: column;
    gap: 8px;
  }

  .run-btn, .submit-btn {
    width: 100%;
  }
}

/* ========== 平板和电脑端 (≥ 768px) ========== */
@media (min-width: 768px) {
  .main-page { /* 默认隐藏，由JS控制显示 */
 display: none !important;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
  }

  .header {
    grid-column: 1 / -1;
  }

  .menu-toggle {
    display: none;
  }

  .close-sidebar {
    display: none;
  }

  .sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    margin: 0;
  }

  .sidebar-overlay {
    display: none !important;
  }

  .lesson-list {
    grid-template-columns: 1fr;
    max-height: none;
  }
}

/* ========== 大屏电脑 (≥ 1024px) ========== */
@media (min-width: 1024px) {
  .main-page {
    grid-template-columns: 300px 1fr;
    gap: 25px;
    max-width: 1400px;
  }

  .sidebar {
    max-height: calc(100vh - 60px);
  }

  #editor {
    height: 400px;
  }
}

/* ===== 弹性学习系统样式 Start ===== */

/* 首页通用 */
.elastic-home {
  padding: 20px;
  max-width: 1000px;
  margin: 0 auto;
}

.welcome-section {
  margin-bottom: 20px;
}

.welcome-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 20px;
}

.welcome-card h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
}

.welcome-card p {
  margin: 0 0 16px 0;
  opacity: 0.9;
}

.quick-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: bold;
}

.stat-label {
  display: block;
  font-size: 12px;
  opacity: 0.9;
}

.section-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-icon {
  font-size: 20px;
  margin-right: 8px;
}

.card-title {
  font-weight: 600;
  font-size: 16px;
  flex: 1;
}

.see-all-btn {
  background: none;
  border: none;
  color: #667eea;
  cursor: pointer;
  font-size: 14px;
}

/* 继续学习卡片 */
.continue-card {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.continue-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.continue-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.continue-lesson {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lesson-emoji {
  font-size: 32px;
}

.lesson-detail h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
}

.lesson-detail p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.continue-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

/* 建议卡片 */
.suggestions-section {
  margin-bottom: 20px;
}

.suggestion-card {
  padding: 12px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.suggestion-success {
  background: #e8f5e9;
  color: #2e7d32;
}

.suggestion-warning {
  background: #fff3e0;
  color: #e65100;
}

.suggestion-info {
  background: #e3f2fd;
  color: #1565c0;
}

.suggestion-icon {
  font-size: 18px;
}

.suggestion-text {
  font-size: 14px;
}

/* 路径推荐卡片 */
.path-recommend-card {
  cursor: pointer;
  border: 2px solid #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
}

.path-recommend-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.path-emoji {
  font-size: 40px;
}

.path-info {
  flex: 1;
}

.path-info h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
}

.path-info p {
  margin: 0 0 8px 0;
  color: #666;
  font-size: 13px;
}

.path-badge {
  display: inline-block;
  background: #667eea;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.start-path-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

/* 薄弱知识点网格 */
.weak-points-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.weak-point-card {
  background: #fff8f5;
  border: 1px solid #ffe0d0;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.weak-point-card:hover {
  transform: translateY(-2px);
}

.wp-name {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 4px;
}

.wp-level {
  font-size: 12px;
  color: #e65100;
  margin-bottom: 8px;
}

.wp-progress {
  height: 4px;
  background: #ffe0d0;
  border-radius: 2px;
  overflow: hidden;
}

.wp-progress-bar {
  height: 100%;
  background: #ff7043;
  border-radius: 2px;
  transition: width 0.3s;
}

/* 题单卡片网格 */
.sets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.set-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.set-card:hover {
  background: #e9ecef;
  transform: translateY(-2px);
}

.set-card .set-emoji {
  font-size: 28px;
}

.set-info h4 {
  margin: 0 0 4px 0;
  font-size: 14px;
}

.set-desc {
  margin: 0 0 6px 0;
  font-size: 12px;
  color: #666;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.set-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.set-lessons {
  font-size: 11px;
  color: #888;
}

.set-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e3f2fd;
  color: #1976d2;
}

.set-tag.tag-reason {
  background: #f3e5f5;
  color: #7b1fa2;
}

/* 学习路径页面 */
.paths-page, .sets-page, .knowledge-page {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
}

.page-header p {
  margin: 0;
  color: #666;
}

.paths-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.path-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.path-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.path-card.locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.path-card-header {
  padding: 20px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.path-emoji-lg {
  font-size: 40px;
}

.recommend-badge {
  background: #667eea;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.path-card-body {
  padding: 0 20px 20px;
}

.path-card-body h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
}

.path-desc {
  margin: 0 0 12px 0;
  font-size: 13px;
  color: #666;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}

.path-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.path-meta span {
  font-size: 12px;
  color: #888;
}

.path-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar-bg {
  flex: 1;
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 3px;
  transition: width 0.3s;
}

.progress-text {
  font-size: 12px;
  color: #666;
  min-width: 50px;
}

.lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  border-radius: 12px;
}

/* 路径详情页面 */
.path-detail-page, .set-detail-page {
  padding: 20px;
  max-width: 900px;
  margin: 0 auto;
}

.back-btn {
  display: inline-block;
  color: #667eea;
  cursor: pointer;
  margin-bottom: 20px;
  font-size: 14px;
}

.back-btn:hover {
  text-decoration: underline;
}

.path-detail-header, .set-detail-header {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
  padding: 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.path-emoji-xl, .set-emoji-xl {
  font-size: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, #667eea20, #764ba220);
  border-radius: 16px;
}

.path-detail-info, .set-detail-info {
  flex: 1;
}

.path-detail-info h2, .set-detail-info h2 {
  margin: 0 0 8px 0;
  font-size: 22px;
}

.path-detail-desc, .set-detail-desc {
  margin: 0 0 16px 0;
  color: #666;
}

.path-detail-meta, .set-detail-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.meta-item {
  font-size: 13px;
  color: #666;
}

.path-progress-large, .set-progress-large {
  margin-top: 8px;
}

.progress-bar-bg-large {
  height: 10px;
  background: #e9ecef;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill-large {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 5px;
  transition: width 0.3s;
}

.path-lessons-list, .set-lessons-list {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}

.path-lessons-list h3, .set-lessons-list h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
}

.lessons-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lesson-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.lesson-item:hover {
  background: #e9ecef;
}

.lesson-item.completed {
  background: #e8f5e9;
  border-left: 3px solid #4caf50;
}

.lesson-item.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.lesson-index {
  width: 28px;
  height: 28px;
  background: #dee2e6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}

.lesson-item.completed .lesson-index {
  background: #4caf50;
  color: white;
}

.lesson-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.lesson-item-emoji {
  font-size: 24px;
}

.lesson-item-text h4 {
  margin: 0 0 2px 0;
  font-size: 14px;
  font-weight: 500;
}

.lesson-item-knowledge {
  margin: 0;
  font-size: 12px;
  color: #888;
}

.lesson-item-status {
  font-size: 16px;
}

.status-completed {
  color: #4caf50;
  font-weight: bold;
}

.status-locked {
  opacity: 0.5;
}

.status-pending {
  color: #667eea;
}

.path-action-bar, .set-action-bar {
  text-align: center;
}

.start-path-btn-large, .start-set-btn-large {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  padding: 14px 40px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.start-path-btn-large:hover, .start-set-btn-large:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 题单广场 */
.category-section {
  margin-bottom: 32px;
}

.category-title {
  margin: 0 0 16px 0;
  font-size: 18px;
  color: #333;
}

.category-sets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.set-card-large {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: all 0.2s;
}

.set-card-large:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.set-card-large.completed {
  border: 2px solid #4caf50;
}

.set-card-large.locked {
  opacity: 0.7;
  border: 2px solid #ffc107;
}

.locked-badge {
  background: linear-gradient(135deg, #ffc107, #ff9800);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.set-card-header {
  padding: 16px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.set-emoji-lg {
  font-size: 32px;
}

.completed-badge {
  background: #4caf50;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.status-locked {
  color: #ffc107;
  font-size: 16px;
}

.locked-lesson {
  opacity: 0.6;
  cursor: pointer;
}

.locked-btn {
  background: linear-gradient(135deg, #ffc107, #ff9800) !important;
}

.set-card-body {
  padding: 0 16px 16px;
}

.set-card-body h4 {
  margin: 0 0 8px 0;
  font-size: 15px;
}

.set-desc-full {
  margin: 0 0 12px 0;
  font-size: 13px;
  color: #666;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}

.set-meta-full {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.set-lessons-full {
  font-size: 12px;
  color: #888;
}

.set-progress-text {
  font-size: 12px;
  color: #667eea;
  font-weight: 500;
}

.set-progress-small {
  margin-top: 4px;
}

.progress-bg-small {
  height: 4px;
  background: #e9ecef;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill-small {
  height: 100%;
  background: #667eea;
  border-radius: 2px;
}

/* 知识点图谱 */
.mastery-overview {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
  margin-bottom: 24px;
}

.overview-card, .radar-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  text-align: center;
}

.overview-circle {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 16px;
}

.overview-percent {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: bold;
  color: #667eea;
}

.overview-card h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
}

.overview-card p {
  margin: 0;
  font-size: 13px;
  color: #666;
}

.radar-card h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  text-align: left;
}

.radar-container {
  display: flex;
  justify-content: center;
}

#radarCanvas {
  max-width: 100%;
}

.strength-weakness {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.strength-section, .weakness-section {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.strength-section h3, .weakness-section h3 {
  margin: 0 0 12px 0;
  font-size: 15px;
}

.strength-list, .weakness-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strength-item, .weakness-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
}

.strength-item {
  background: #e8f5e9;
}

.weakness-item {
  background: #fff8f5;
  cursor: pointer;
  transition: background 0.2s;
}

.weakness-item:hover {
  background: #ffe0d0;
}

.strength-name, .weakness-name {
  font-size: 14px;
}

.strength-badge.strong {
  background: #4caf50;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.weakness-badge.weak {
  background: #ff7043;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.category-mastery-section h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
}

.category-mastery-group {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}

.category-name {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #667eea;
  font-weight: 500;
}

.category-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.knowledge-item-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
}

.ki-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.ki-name {
  font-size: 13px;
  font-weight: 500;
}

.ki-level {
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
}

.ki-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.ki-progress-bg {
  flex: 1;
  height: 4px;
  background: #e9ecef;
  border-radius: 2px;
  overflow: hidden;
}

.ki-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

.ki-percent {
  font-size: 11px;
  color: #666;
  min-width: 30px;
  text-align: right;
}

.ki-stats {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #888;
}

/* 导航分割线 */
.nav-divider {
  height: 1px;
  background: #e9ecef;
  margin: 8px 0;
}

/* 响应式适配 */
@media (max-width: 768px) {
  .mastery-overview {
    grid-template-columns: 1fr;
  }
  
  .strength-weakness {
    grid-template-columns: 1fr;
  }
  
  .path-detail-header, .set-detail-header {
    flex-direction: column;
    text-align: center;
  }
  
  .path-emoji-xl, .set-emoji-xl {
    margin: 0 auto;
  }
  
  .quick-stats {
    justify-content: center;
  }
  
  .continue-info {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  
  .path-recommend-content {
    flex-direction: column;
    text-align: center;
  }
}

/* ===== 弹性学习系统样式 End ===== */

/* ===== 宠物折叠功能 ===== */
.pet-toggle-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: #f39c12;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.2s;
}

.pet-toggle-btn:hover {
  transform: scale(1.1);
  background: #e67e22;
}

.pet-display.collapsed {
  width: 40px !important;
  height: 40px !important;
  min-width: unset !important;
  padding: 0 !important;
  justify-content: center !important;
}

.pet-display.collapsed .pet-status-mini,
.pet-display.collapsed .pet-emoji,
.pet-display.collapsed img {
  display: none !important;
}

.pet-display.collapsed::after {
  content: '🐱';
  font-size: 20px;
}

.pet-mini-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  z-index: 99;
  transition: all 0.3s;
  border: none;
}

.pet-mini-btn:hover {
  transform: scale(1.1);
}

.pet-mini-btn.hidden {
  display: none;
}

/* ===== 快捷入口样式 ===== */
.quick-entry-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.quick-entry-card {
  background: white;
  padding: 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.quick-entry-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.entry-icon {
  font-size: 28px;
  min-width: 40px;
  text-align: center;
}

.entry-text {
  flex: 1;
}

.entry-text h3 {
  margin: 0 0 4px 0;
  font-size: 15px;
  color: #333;
}

.entry-text p {
  margin: 0;
  font-size: 12px;
  color: #999;
}

.entry-arrow {
  font-size: 18px;
  color: #667eea;
  font-weight: bold;
}


/* ===== 学生主界面样式 ===== */
#mainPage {
  display: none;
  height: 100vh;
  grid-template-columns: 280px 1fr;
}

/* ===== 顶部功能栏优化（手机端适配）===== */
.top-bar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 12px 16px;
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(102, 126, 234, 0.3);
}

.top-bar-content {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* 用户信息区域 */
.user-info-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 2px solid rgba(255,255,255,0.5);
}

.user-details {
  flex: 1;
}

.user-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.user-progress {
  font-size: 12px;
  opacity: 0.9;
}

/* 会员标签 */
.membership-badge {
  background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
  color: #8b4513;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* 快捷数据卡片 */
.quick-stats-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.2);
}

.stat-card {
  flex: 1;
  background: rgba(255,255,255,0.15);
  padding: 8px 12px;
  border-radius: 10px;
  text-align: center;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
}

.stat-label {
  font-size: 10px;
  opacity: 0.9;
}

/* 操作按钮 */
.top-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.icon-btn:hover {
  background: rgba(255,255,255,0.35);
  transform: scale(1.05);
}

/* 手机端适配 */
@media (max-width: 768px) {
  .top-bar {
    padding: 10px 12px;
  }
  
  .user-avatar {
    width: 42px;
    height: 42px;
    font-size: 20px;
  }
  
  .user-name {
    font-size: 15px;
  }
  
  .user-progress {
    font-size: 11px;
  }
  
  .stat-value {
    font-size: 16px;
  }
  
  .stat-label {
    font-size: 9px;
  }
  
  .membership-badge {
    font-size: 10px;
    padding: 3px 8px;
  }
}
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 12px rgba(102, 126, 234, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* 左侧logo区域 */
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 右侧按钮区域 */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 会员标签 */
.membership-tag {
  background: rgba(255,255,255,0.95) !important;
  color: #d97706 !important;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700 !important;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

.membership-tag:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

/* 图标按钮 */
.header-right .icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.header-right .icon-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.1);
}

/* 手机端适配 */
@media (max-width: 768px) {
  .header {
    padding: 10px 12px;
  }
  
  .membership-tag {
    font-size: 11px;
    padding: 4px 10px;
  }
  
  .header-right .icon-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .header-btns {
    display: none;
  }
}
/* ========== 首页高度自适应修复 ========== */
html {
  height: auto !important;
  min-height: 100vh !important;
}

body {
  height: auto !important;
  min-height: 100vh !important;
  overflow-y: auto !important;
}

#app {
  height: auto !important;
  min-height: 100vh !important;
}

.main-content {
  height: auto !important;
  min-height: 500px !important;
  overflow: visible !important;
}

.elastic-home {
  height: auto !important;
  min-height: auto !important;
  overflow: visible !important;
}

/* 修复flex布局子元素高度限制 */
.layout-container,
.app-container,
.main-container,
.wrapper,
#lessonContent {
  height: auto !important;
  min-height: 100vh !important;
  overflow: visible !important;
}

/* 修复子元素不被压缩 */
.layout-container > *,
.app-container > *,
.main-container > * {
  flex-shrink: 0 !important;
}


/* ========== 确保所有 .main-page 高度自适应 ========== */
.main-page {
  height: auto !important;
  min-height: 100vh !important;
}


/* ========== 左侧「我的学习」进度中心样式 ========== */
.sidebar-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}
.sidebar-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin: 0 0 10px 0;
}
/* 个人信息卡片 */
.sidebar-profile-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sp-avatar {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
}
.sp-info {
  flex: 1;
}
.sp-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}
.sp-level {
  font-size: 12px;
  opacity: 0.9;
}
.sp-stars {
  background: rgba(255,255,255,0.2);
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 13px;
}
/* 今日概览 */
.today-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.today-stat-item {
  text-align: center;
}
.today-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #667eea;
}
.today-stat-label {
  font-size: 11px;
  color: #666;
  margin-top: 2px;
}
/* 最近学习 */
.recent-lessons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.recent-empty {
  text-align: center;
  padding: 15px 0;
  color: #999;
  font-size: 12px;
}
.recent-lesson-item {
  background: white;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.recent-lesson-item:hover {
  background: #e9ecef;
  transform: translateX(3px);
}
.recent-lesson-emoji {
  font-size: 18px;
}
.recent-lesson-info {
  flex: 1;
}
.recent-lesson-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
}
.recent-lesson-time {
  font-size: 11px;
  color: #999;
}
/* 快捷入口 */
.quick-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.quick-link-item {
  background: white;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.quick-link-item:hover {
  background: #667eea;
  color: white;
}
/* 大屏适配 */
@media (min-width: 1024px) {
  .sidebar {
    min-width: 260px;
  }
  .quick-links {
    grid-template-columns: 1fr;
  }
}


/* ========== Sidebar Tab 切换样式 ========== */
.sidebar-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 15px;
}
.sidebar-tab {
  padding: 8px 10px;
  text-align: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: #f8f9fa;
  color: #666;
  transition: all 0.2s;
}
.sidebar-tab:hover {
  background: #e9ecef;
}
.sidebar-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}
.sidebar-tab-content {
  display: block;
}

/* 课程列表在 Tab 里的样式 */
#lessonList.sidebar-tab-content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 5px;
}
@media (min-width: 1024px) {
  #lessonList.sidebar-tab-content {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 250px);
  }
}

/* 左侧课程列表中当前选中关卡的高亮样式 */
.lesson-item.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  transform: translateX(3px);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* ========== 宠物面板聊天样式优化 ========== */
#petChatMessages {
    min-height: 280px;
    background: linear-gradient(135deg, #fafbfc 0%, #f3f4f6 100%) !important;
}

#petChatMessages > div {
    animation: slideIn 0.2s ease;
}

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

/* ============================================
   🎁 通关宝箱动画样式
   ============================================ */

/* 宝箱遮罩层 */
.reward-box-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 宝箱容器 */
.reward-box-container {
  text-align: center;
  animation: boxBounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes boxBounceIn {
  0% { 
    transform: translateY(-500px) rotate(-20deg) scale(0.5);
    opacity: 0;
  }
  60% { 
    transform: translateY(30px) rotate(10deg) scale(1.1);
  }
  80% { 
    transform: translateY(-15px) rotate(-5deg) scale(0.95);
  }
  100% { 
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 1;
  }
}

/* 宝箱主体 */
.reward-box {
  width: 200px;
  height: 160px;
  position: relative;
  cursor: pointer;
  margin: 0 auto 20px;
}

/* 宝箱晃动动画 */
.reward-box.shake {
  animation: boxShake 0.5s ease-in-out infinite;
}

@keyframes boxShake {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

/* 宝箱底部 */
.reward-box-body {
  width: 100%;
  height: 100px;
  background: linear-gradient(180deg, #8B4513 0%, #654321 100%);
  border-radius: 10px;
  position: absolute;
  bottom: 0;
  box-shadow: 
    0 10px 20px rgba(0,0,0,0.4),
    inset 0 -5px 10px rgba(0,0,0,0.3),
    inset 0 5px 10px rgba(255,255,255,0.1);
}

/* 宝箱盖子 */
.reward-box-lid {
  width: 110%;
  height: 70px;
  background: linear-gradient(180deg, #A0522D 0%, #8B4513 100%);
  border-radius: 10px 10px 0 0;
  position: absolute;
  top: 0;
  left: -5%;
  transform-origin: bottom center;
  transition: transform 0.4s ease-out;
  box-shadow: 
    0 -5px 15px rgba(0,0,0,0.3),
    inset 0 5px 10px rgba(255,255,255,0.2);
}

/* 宝箱打开时盖子飞起 */
.reward-box.opened .reward-box-lid {
  transform: rotateX(-120deg) translateY(-30px);
}

/* 宝箱锁扣 */
.reward-box-lock {
  width: 40px;
  height: 30px;
  background: linear-gradient(180deg, #FFD700 0%, #FFA500 100%);
  border-radius: 5px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.reward-box-lock::before {
  content: '';
  width: 20px;
  height: 15px;
  border: 4px solid #FFD700;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
}

/* 宝箱光效 */
.reward-box-glow {
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255,215,0,0.4) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: glowPulse 1.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
}

/* 宝箱打开时的金光爆发 */
.reward-box.opened .reward-box-glow {
  animation: glowBurst 0.5s ease-out forwards;
}

@keyframes glowBurst {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(3); }
}

/* 提示文字 */
.reward-box-hint {
  color: #FFD700;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  animation: hintBlink 1s ease-in-out infinite;
}

@keyframes hintBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* 星星飞出动画容器 */
.reward-stars-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* 单个星星 */
.reward-star {
  position: absolute;
  font-size: 40px;
  opacity: 0;
}

/* 星星飞出动画 */
@keyframes starFlyOut {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(0.5);
  }
  50% {
    opacity: 1;
    transform: translate(var(--tx), var(--ty)) scale(1.5);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx2), var(--ty2)) scale(0.3);
  }
}

/* 奖励展示卡片 */
.reward-card {
  background: linear-gradient(180deg, #fff9e6 0%, #fff 100%);
  border-radius: 15px;
  padding: 30px 50px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  animation: cardSlideUp 0.5s ease-out 0.3s both;
}

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

.reward-card h2 {
  color: #FF6B35;
  margin: 0 0 20px;
  font-size: 24px;
}

.reward-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin: 15px 0;
}

.reward-item-icon {
  font-size: 40px;
  animation: itemBounce 0.5s ease-out;
}

@keyframes itemBounce {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.reward-item-text {
  font-size: 28px;
  font-weight: bold;
  color: #333;
}

.reward-item-count {
  color: #FF6B35;
  animation: countUp 1s ease-out;
}

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

/* 继续按钮 */
.reward-continue-btn {
  margin-top: 25px;
  padding: 12px 40px;
  font-size: 18px;
  font-weight: bold;
  color: white;
  background: linear-gradient(180deg, #667eea 0%, #5a67d8 100%);
  border: none;
  border-radius: 25px;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
  transition: all 0.3s;
  animation: btnAppear 0.5s ease-out 0.6s both;
}

@keyframes btnAppear {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.reward-continue-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
}

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

/* ============================================
   🎁 通关宝箱系统 - Phase 2 增强版
   ============================================ */

/* 稀有度光效 - 普通 */
.reward-rarity-common .reward-box-glow {
  background: radial-gradient(circle, rgba(156, 163, 175, 0.5) 0%, transparent 70%);
}

/* 稀有度光效 - 稀有 */
.reward-rarity-rare .reward-box-glow {
  background: radial-gradient(circle, rgba(59, 130, 246, 0.6) 0%, transparent 70%);
}

/* 稀有度光效 - 史诗 */
.reward-rarity-epic .reward-box-glow {
  background: radial-gradient(circle, rgba(147, 51, 234, 0.6) 0%, transparent 70%);
}

/* 稀有度光效 - 传说 */
.reward-rarity-legendary .reward-box-glow {
  background: radial-gradient(circle, rgba(251, 191, 36, 0.7) 0%, transparent 70%);
  animation: legendaryGlow 1s ease-in-out infinite;
}

@keyframes legendaryGlow {
  0%, 100% { 
    opacity: 0.6; 
    transform: translate(-50%, -50%) scale(1); 
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.5);
  }
  50% { 
    opacity: 1; 
    transform: translate(-50%, -50%) scale(1.3); 
    box-shadow: 0 0 60px rgba(251, 191, 36, 0.8);
  }
}

/* 粒子爆炸特效容器 */
.reward-particles {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  pointer-events: none;
  z-index: -1;
}

/* 单个粒子 */
.reward-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  opacity: 0;
}

/* 粒子爆炸动画 */
@keyframes particleExplode {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--px), var(--py)) scale(0);
  }
}

/* 不同颜色的粒子 */
.reward-particle.gold { background: #FFD700; }
.reward-particle.blue { background: #3B82F6; }
.reward-particle.purple { background: #9333EA; }
.reward-particle.green { background: #10B981; }
.reward-particle.red { background: #EF4444; }

/* 多掉落物网格 */
.reward-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.reward-item-mini {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  padding: 15px;
  text-align: center;
  border: 2px solid #dee2e6;
  animation: miniItemBounce 0.5s ease-out backwards;
}

.reward-item-mini.rarity-common { border-color: #9CA3AF; }
.reward-item-mini.rarity-rare { border-color: #3B82F6; background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%); }
.reward-item-mini.rarity-epic { border-color: #9333EA; background: linear-gradient(135deg, #F5F3FF 0%, #EDE9FE 100%); }
.reward-item-mini.rarity-legendary { border-color: #FBBF24; background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%); }

@keyframes miniItemBounce {
  0% { opacity: 0; transform: scale(0.5) translateY(20px); }
  60% { transform: scale(1.1) translateY(-5px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.reward-item-mini-icon {
  font-size: 36px;
  margin-bottom: 8px;
  display: block;
}

.reward-item-mini-name {
  font-size: 14px;
  color: #374151;
  font-weight: 600;
  margin-bottom: 4px;
}

.reward-item-mini-count {
  font-size: 20px;
  font-weight: bold;
  color: #059669;
}

/* 稀有度标签 */
.reward-rarity-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 15px;
}

.reward-rarity-tag.common { background: #9CA3AF; color: white; }
.reward-rarity-tag.rare { background: #3B82F6; color: white; }
.reward-rarity-tag.epic { background: #9333EA; color: white; }
.reward-rarity-tag.legendary { background: linear-gradient(90deg, #F59E0B, #FBBF24); color: white; }

/* 掉落物飞出动画 */
@keyframes itemFlyIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) rotate(-180deg);
  }
  60% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2) rotate(10deg);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

.reward-flying-item {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 60px;
  opacity: 0;
  z-index: 10;
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
}

.reward-flying-item.animate {
  animation: itemFlyIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* 多重掉落物 - 依次出现 */
.reward-flying-item:nth-child(1) { animation-delay: 0.1s; }
.reward-flying-item:nth-child(2) { animation-delay: 0.3s; }
.reward-flying-item:nth-child(3) { animation-delay: 0.5s; }
.reward-flying-item:nth-child(4) { animation-delay: 0.7s; }
.reward-flying-item:nth-child(5) { animation-delay: 0.9s; }

/* 闪光划过特效 */
.reward-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transform: skewX(-25deg);
  animation: shineSweep 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shineSweep {
  0% { left: -100%; }
  50%, 100% { left: 200%; }
}

/* ===== 代码编辑器一键最大化按钮 ===== */
.maximize-btn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  line-height: 1;
}
.maximize-btn:hover {
  background: linear-gradient(135deg, #5a6fd6, #6a3f8f);
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}
.maximize-btn.maximized {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  font-size: 20px;
}
.maximize-btn.maximized:hover {
  background: linear-gradient(135deg, #dc3545, #a71d2a);
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* 最大化模式下 editor 过渡动画 */
#editor {
  transition: height 0.3s ease;
}
.main-content {
  transition: all 0.3s ease;
}

