@charset "UTF-8";

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* Segoe UI 不含中文，需回退到系统黑体，避免部分环境显示异常 */
  font-family: 'Segoe UI', 'Microsoft YaHei UI', 'Microsoft YaHei', 'PingFang SC',
    'Noto Sans CJK SC', sans-serif;
}

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container {
  background-color: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 900px;
  padding: 40px;
  text-align: center;
  position: relative;
}

h1 {
  color: #667eea;
  margin-bottom: 30px;
  font-size: 2.5rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

/* 修改代码2 */
/* 进入模式选择时：隐藏“单词学习系统”（带动画） */
#page-title {
  overflow: hidden;
  max-height: 200px;
  transition: opacity 280ms ease, transform 280ms ease, max-height 280ms ease, margin 280ms ease;
  transform-origin: center top;
}

#page-title.title-hidden {
  opacity: 0;
  transform: translateY(-10px) scale(0.96);
  max-height: 0;
  margin-bottom: 0;
}

/* 模式选择标题：做成类似 h1 的效果，并在进入时放大动画 */
#mode-screen > h2 {
  color: #667eea;
  font-size: 2.2rem;
  margin: 10px 0 18px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
  transform-origin: center;
}

@keyframes modeTitlePop {
  0%   { transform: scale(1); opacity: 0.85; }
  45%  { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

#mode-screen > h2.mode-title-pop {
  animation: modeTitlePop 520ms ease-out both;
}

/* 模式选择界面 - 上二下二布局 */
.mode-selection {
  display: grid;
  grid-template-columns: 1fr 1fr;  /* 明确两列，平均分配 */
  gap: 30px;
  margin: 40px 0;
  max-width: 800px;  /* 限制最大宽度，确保两列不溢出 */
  margin-left: auto;
  margin-right: auto;
}

.mode-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 15px;
  padding: 30px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.mode-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.mode-card.game-mode {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.mode-card.challenge-mode {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.mode-card.recite-mode {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.mode-card.listening-mode {
  background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
}

.mode-card.review-mode {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.mode-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.mode-title {
  font-size: 1.8rem;
  font-weight: bold;
  margin-bottom: 10px;
}

.mode-description {
  font-size: 1rem;
  opacity: 0.9;
  line-height: 1.5;
}

/* 用户信息显示在右上角 */
.user-info {
  display: none;
  position: absolute;
  top: 20px;
  right: 30px;
  background: rgba(255, 255, 255, 0.9);
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 14px;
  color: #333;
  text-align: left;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.user-info span {
  display: block;
  margin-bottom: 4px;
}

.user-info span:last-child {
  margin-bottom: 0;
}

.hidden {
  display: none !important;
}

/* 关卡选择 */
.level-selection {
  margin: 30px 0;
}

.book-selection {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 15px 0 5px;
  flex-wrap: wrap;
}

.book-selection-label {
  font-size: 1rem;
  color: #333;
  font-weight: 500;
}

.book-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid #667eea;
  background: #fff;
  color: #667eea;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  min-width: 96px;
}

.book-btn:hover {
  background: #eef1ff;
}

.book-btn.selected {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

/* 四级真题：单词卡面板 */
.wordcard-panel {
  width: 100%;
  max-width: 760px;
  margin: 10px auto 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8f9fa;
  border: 1px solid #eef1ff;
  text-align: left;
}

.wordcard-title {
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.wordcard-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.wordcard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid #f1f3f5;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.wordcard-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  border-color: #dfe3ff;
}

.wordcard-item:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
  border-color: #667eea;
}

.wordcard-item.selected {
  border-color: transparent;
  background: linear-gradient(135deg, rgba(102,126,234,0.12) 0%, rgba(118,75,162,0.10) 100%);
  box-shadow: 0 10px 22px rgba(102, 126, 234, 0.18);
}

@keyframes wordcardPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.wordcard-item.wordcard-selected-pop {
  animation: wordcardPop 320ms ease-out both;
}

.wordcard-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #333;
  font-weight: 500;
}


.level-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 15px;
  margin-top: 20px;
}

.level-btn {
  flex: 0 1 150px;
  min-width: 140px;
  max-width: 220px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 20px;
  border-radius: 10px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.level-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.level-btn.selected {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.level-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* 按钮样式 */
.btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 10px;
  font-size: 1.1rem;
  cursor: pointer;
  margin: 10px;
  transition: all 0.3s ease;
}

.btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-back {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  color: #333;
}

/* 游戏区域 */
.game-container {
  margin: 30px 0;
}

.game-info {
  display: flex;
  justify-content: space-around;
  background-color: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.info-item {
  text-align: center;
}

.info-label {
  font-size: 0.9rem;
  color: #666;
}

.info-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #667eea;
  margin-top: 5px;
}

.word-display {
  font-size: 3rem;
  font-weight: bold;
  color: #333;
  margin: 30px 0;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.options-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin: 30px 0;
}

.option-btn {
  background: white;
  border: 2px solid #667eea;
  color: #333;
  padding: 20px;
  border-radius: 10px;
  font-size: 1.4rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.option-btn:hover {
  background: #667eea;
  color: white;
  transform: scale(1.02);
}

.option-btn.correct {
  background: #43e97b;
  border-color: #43e97b;
  color: white;
}

.option-btn.incorrect {
  background: #f5576c;
  border-color: #f5576c;
  color: white;
}

.option-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* 结果弹窗 */
.result-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.result-content {
  background: white;
  padding: 40px;
  border-radius: 20px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.result-title {
  font-size: 2rem;
  margin-bottom: 20px;
  color: #667eea;
}

.result-stats {
  margin: 20px 0;
  text-align: left;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.wrong-words-list {
  margin: 20px 0;
  text-align: left;
}

.wrong-word-item {
  background: #f8f9fa;
  padding: 15px;
  margin: 10px 0;
  border-radius: 10px;
  border-left: 4px solid #f5576c;
}

/* 背诵模式样式 */
.word-list {
  max-height: 500px;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 20px 0;
}

.word-item {
  display: flex;
  justify-content: space-between;
  padding: 15px 20px;
  background: #f8f9fa;
  margin: 10px 0;
  border-radius: 10px;
  transition: all 0.3s ease;
  min-width: 0; /* 防止子元素撑出导致横向滚动条 */
}

.word-item:hover {
  background: #e9ecef;
  transform: translateX(5px);
}

.word-english {
  font-size: 1.3rem;
  font-weight: bold;
  color: #333;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-info {
  text-align: right;
  flex-shrink: 0;
}

.word-type {
  color: #667eea;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.word-chinese {
  font-size: 1.1rem;
  color: #666;
}

/* 登录注册表单 */
.auth-container {
  max-width: 400px;
  margin: 0 auto;
}

#login-form .btn,
#register-form .btn {
  display: block;
  margin: 16px auto 0;
}

.form-group {
  margin: 20px 0;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
}

.toggle-auth {
  color: #667eea;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 15px;
  display: block;
  text-align: center;
}

/* 听力模式样式 */
.listening-panel {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  text-align: left;
}

.listening-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.listening-row label {
  font-size: 0.95rem;
  color: #333;
  font-weight: 500;
}

.listening-hint {
  font-size: 0.9rem;
  color: #666;
  margin-top: 10px;
  line-height: 1.5;
}

.playlist {
  margin-top: 15px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  background: #fff;
}

.track-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #f1f3f5;
  cursor: pointer;
}

.track-item:last-child {
  border-bottom: none;
}

.track-item:hover {
  background: #f8f9fa;
}

.track-item.active {
  background: #e7f5ff;
  border-left: 4px solid #4facfe;
  padding-left: 10px;
}

.track-name {
  font-weight: 600;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 520px;
}

.track-meta {
  font-size: 0.85rem;
  color: #888;
  white-space: nowrap;
}

@media (max-width: 768px) {
  /* 模式选择：小屏幕下改为单列，避免拥挤 */
  .mode-selection {
      grid-template-columns: 1fr;
      gap: 20px;
  }
  
  .options-container {
      grid-template-columns: 1fr;
  }
  
  h1 {
      font-size: 2rem;
  }
  
  .word-display {
      font-size: 2rem;
  }

  .track-name {
      max-width: 220px;
  }
}

/* 认证弹窗样式 */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.auth-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-content h2 {
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.auth-form input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-form button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 8px;
}

.auth-form button[type="submit"]:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.auth-message {
    margin-top: 12px;
    text-align: center;
    min-height: 20px;
}

@media (max-width: 768px) {
  .container {
    padding: 20px;
    width: 95%;
  }

  .mode-selection {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 30px 0;
  }

  .options-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .option-btn {
    padding: 15px;
    font-size: 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.8rem;
  }

  .word-display {
    font-size: 2rem;
    min-height: 80px;
  }

  .track-name {
    max-width: 220px;
  }

  .user-info {
    position: absolute;
    top: 10px;
    right: 10px;
    margin: 0;
    text-align: left;
    display: none;
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  .game-info {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    justify-content: space-around;
  }

  .info-item {
    flex-direction: column;
    gap: 2px;
    min-width: 60px;
  }

  .info-label {
    font-size: 0.7rem;
  }

  .info-value {
    font-size: 0.9rem;
  }

  .word-display {
    text-align: center;
    font-size: 1.8rem;
    min-height: 80px;
  }

  .level-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }

  .level-btn {
    padding: 15px;
    font-size: 1rem;
  }

  .btn {
    padding: 12px 24px;
    font-size: 1rem;
    margin: 8px;
  }

  .mode-card {
    padding: 20px 15px;
  }

  .mode-icon {
    font-size: 2.5rem;
  }

  .mode-title {
    font-size: 1.5rem;
  }

  .mode-description {
    font-size: 0.9rem;
  }

  .study-record-container {
    overflow-x: auto;
  }

  .study-record-header,
  .study-record-item {
    grid-template-columns: repeat(5, 1fr);
    font-size: 0.8rem;
    padding: 10px;
  }

  .info-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .word-list {
    max-height: 400px;
  }

  .word-item {
    padding: 12px 15px;
  }

  .word-english {
    font-size: 1.1rem;
  }

  .word-chinese {
    font-size: 1rem;
  }

  .book-selection {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
  }

  .book-selection-label {
    white-space: nowrap;
    margin-right: 5px;
  }

  .book-btn {
    min-width: 70px;
    padding: 6px 12px;
    font-size: 0.8rem;
    margin: 0;
  }

  .listening-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .listening-row label {
    font-size: 0.85rem;
  }

  .result-content {
    padding: 30px 20px;
  }

  .result-title {
    font-size: 1.8rem;
  }

  .auth-container {
    max-width: 100%;
  }

  .form-group input {
    padding: 10px;
    font-size: 0.9rem;
  }

  .form-group select {
    padding: 10px;
    font-size: 0.9rem;
  }

  .wordcard-panel {
    padding: 10px;
  }

  .wordcard-item {
    padding: 8px 10px;
  }

  .wordcard-name {
    font-size: 0.9rem;
  }

  .trend-chart {
    height: 250px;
  }

  .chart-bar {
    height: 150px;
    gap: 10px;
  }

  .chart-column {
    min-width: 30px;
  }

  .chart-label {
    font-size: 0.7rem;
    bottom: -25px;
  }

  .chart-value {
    font-size: 0.7rem;
    top: -20px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 15px;
  }

  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .word-display {
    font-size: 1.8rem;
  }

  .mode-icon {
    font-size: 2rem;
  }

  .mode-title {
    font-size: 1.3rem;
  }

  .mode-description {
    font-size: 0.8rem;
  }

  .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
    margin: 6px;
  }

  .level-btn {
    padding: 12px;
    font-size: 0.9rem;
  }

  .level-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .study-record-header,
  .study-record-item {
    font-size: 0.7rem;
    padding: 8px;
  }

  .word-english {
    font-size: 1rem;
  }

  .word-chinese {
    font-size: 0.9rem;
  }

  .result-content {
    padding: 20px 15px;
  }

  .result-title {
    font-size: 1.5rem;
  }

  .game-info {
    padding: 10px;
  }

  .info-value {
    font-size: 1.2rem;
  }

  .book-selection {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
  }

  .book-selection-label {
    white-space: nowrap;
    margin-right: 3px;
    font-size: 0.75rem;
  }

  .book-btn {
    min-width: 60px;
    padding: 4px 8px;
    font-size: 0.7rem;
    margin: 0;
  }

  .listening-panel {
    padding: 15px;
  }

  .listening-row button {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .audio-speed {
    font-size: 0.8rem;
  }

  .wordcard-name {
    font-size: 0.8rem;
  }

  .trend-chart {
    height: 200px;
  }

  .chart-bar {
    height: 120px;
    gap: 8px;
  }

  .chart-column {
    min-width: 25px;
  }

  .chart-label {
    font-size: 0.6rem;
    bottom: -20px;
  }

  .chart-value {
    font-size: 0.6rem;
    top: -15px;
  }
}

/* 编辑资料表单 */
.edit-profile-form {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.edit-profile-form .form-group {
    margin: 12px 0;
}

.edit-profile-form .form-group label {
    display: block;
    margin-bottom: 4px;
    color: #666;
    font-size: 0.9rem;
}

.edit-profile-form .form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.edit-profile-form .form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.edit-form-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 15px;
}

.profile-edit-btn {
    width: 100%;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px;
    font-size: 0.95rem;
}

/* 头像选择器 */
.avatar-selector {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.avatar-selector-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 360px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.avatar-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

.avatar-selector-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding: 16px;
    overflow-y: auto;
    max-height: 60vh;
}

.avatar-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    background: #f5f5f5;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.avatar-item:hover {
    background: #e9ecef;
    transform: scale(1.1);
}

.avatar-item.selected {
    border-color: #667eea;
    background: #eef1ff;
}

/* 用户头像按钮 - 定位在大白方框右上角 */
.user-avatar-wrapper {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 右下角用户头像按钮 */
.user-avatar-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.user-avatar-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* 用户头像标签 */
.user-avatar-label {
    color: #667eea;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    margin-top: 5px;
}

/* 隐藏头像按钮（进入游戏后） */
.user-avatar-wrapper.hidden {
    display: none !important;
}

/* 个人主页面板 */
.profile-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.35s ease;
    display: flex;
    flex-direction: column;
    visibility: hidden;
    pointer-events: none;
}

.profile-panel.show {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
}

.profile-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.profile-panel-header h3 {
    margin: 0;
    font-size: 1.2rem;
    flex: 1;
}

.profile-back-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-right: 10px;
}

.profile-back-btn:hover {
    background: rgba(255,255,255,0.3);
}

.profile-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.profile-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.profile-avatar {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
    width: 100%;
}

.profile-avatar > span {
    font-size: 4rem;
    display: inline-block;
    width: 100px;
    height: 100px;
    line-height: 100px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
}

.avatar-edit-hint {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 10px;
    cursor: pointer;
}

.profile-info {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 15px;
}

.profile-info-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.profile-info-item:last-child {
    border-bottom: none;
}

.profile-info-label {
    color: #888;
    font-size: 0.95rem;
}

.profile-info-value {
    color: #333;
    font-weight: 500;
    font-size: 0.95rem;
}

.profile-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-menu-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #f8f9fa;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    color: #333;
    transition: all 0.2s ease;
    text-align: left;
}

.profile-menu-btn:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.profile-menu-btn.logout-btn {
    background: #fff0f0;
    color: #e74c3c;
    margin-top: 10px;
}

.profile-menu-btn.logout-btn:hover {
    background: #ffe0e0;
}

/* 错题本样式 */
.wrong-words-date-group {
    margin-bottom: 20px;
}

.wrong-words-date-title {
    font-size: 1rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #667eea;
}

.wrong-word-card {
    background: #fff;
    border: 1px solid #eee;
    border-left: 4px solid #f5576c;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.wrong-word-english {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.wrong-word-detail {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 3px;
}

.wrong-word-user-answer {
    font-size: 0.9rem;
    color: #f5576c;
}

.wrong-word-empty {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-size: 1rem;
}

.wrong-word-empty span {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
}

/* 学习统计样式 */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.stats-card.green {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stats-card.orange {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stats-value {
    font-size: 2rem;
    font-weight: bold;
}

.stats-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 4px;
}

.trend-chart {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.trend-chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.chart-container {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 150px;
    padding: 0 5px;
    gap: 8px;
}

.chart-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.chart-bar {
    width: 100%;
    max-width: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px 6px 0 0;
    transition: height 0.5s ease;
    position: relative;
    min-height: 4px;
}

.chart-bar-value {
    font-size: 0.7rem;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 4px;
}

.chart-bar-label {
    font-size: 0.65rem;
    color: #888;
    margin-top: 6px;
    text-align: center;
}

/* 游戏界面隐藏右上角用户信息 */
#game-screen .user-info,
#level-screen .user-info,
#recite-screen .user-info,
#listening-screen .user-info {
    display: none;
}

/* ====== 平板适配 (768px - 1024px) ====== */
@media (max-width: 1024px) {
    .profile-panel {
        width: 85vw;
        max-width: 400px;
    }

    .profile-avatar > span {
        width: 90px;
        height: 90px;
        font-size: 3.5rem;
    }

    .avatar-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ====== 手机适配 (320px - 768px) ====== */
@media (max-width: 768px) {
    .profile-panel {
        width: 100vw;
        max-width: 100vw;
        border-radius: 20px 20px 0 0;
        top: auto;
        bottom: 0;
        height: 85vh;
        transform: translateY(100%);
    }

    .profile-panel.show {
        transform: translateY(0);
    }

    .profile-panel-content {
        padding: 16px;
    }

    .profile-avatar {
        margin-bottom: 16px;
    }

    .profile-avatar > span {
        width: 80px;
        height: 80px;
        font-size: 3rem;
    }

    .avatar-edit-hint {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .profile-info {
        padding: 12px;
    }

    .profile-info-item {
        padding: 8px 0;
    }

    .profile-info-label,
    .profile-info-value {
        font-size: 0.9rem;
    }

    .profile-menu-btn {
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    .user-avatar-btn {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    /* 编辑表单 */
    .edit-profile-form {
        padding: 12px;
    }

    .edit-profile-form .form-group {
        margin: 10px 0;
    }

    .edit-profile-form .form-group input {
        padding: 9px 10px;
        font-size: 0.9rem;
    }

    .edit-form-buttons {
        flex-direction: row;
    }

    .edit-form-buttons .btn {
        flex: 1;
        padding: 10px;
        font-size: 0.9rem;
    }

    /* 头像选择器 */
    .avatar-selector-content {
        width: 95%;
        max-height: 75vh;
    }

    .avatar-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
        padding: 12px;
    }

    .avatar-item {
        font-size: 1.5rem;
    }

    /* 错题本 */
    .wrong-words-date-title {
        font-size: 0.95rem;
    }

    .wrong-word-card {
        padding: 10px 12px;
    }

    .wrong-word-english {
        font-size: 1rem;
    }

    .wrong-word-detail,
    .wrong-word-user-answer {
        font-size: 0.85rem;
    }

    /* 统计 */
    .stats-summary {
        gap: 10px;
    }

    .stats-card {
        padding: 14px 10px;
    }

    .stats-value {
        font-size: 1.6rem;
    }

    .stats-label {
        font-size: 0.75rem;
    }
}

/* ====== 小屏手机 (小于 480px) ====== */
@media (max-width: 480px) {
    .profile-panel-content {
        padding: 12px;
    }

    .profile-avatar > span {
        width: 70px;
        height: 70px;
        font-size: 2.5rem;
    }

    .profile-panel-header h3 {
        font-size: 1.1rem;
    }

    .avatar-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }

    .avatar-item {
        font-size: 1.4rem;
    }

    .profile-menu-btn {
        padding: 11px 12px;
        font-size: 0.9rem;
    }

    .profile-edit-btn {
        padding: 10px;
        font-size: 0.9rem;
    }

    /* 首页头像按钮适配 */
    .user-avatar-wrapper {
        top: 15px;
        right: 15px;
    }

    .user-avatar-btn {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }

    .user-avatar-label {
        font-size: 0.75rem;
    }
}