/* 全屏加载界面 */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a73e8, #1557b0);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.4s,
    visibility 0.4s;
}

.loading-screen.hide {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 20px;
}

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

.loading-text {
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.loading-sub {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
}

/* 任务栏 */
.taskbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, #1a73e8, #1557b0);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  flex-wrap: wrap;
  gap: 12px;
}

.taskbar .logo {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  white-space: nowrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 500px;
  min-width: 250px;
}

.search-box input {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  outline: none;
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  transition: box-shadow 0.2s;
}

.search-box input:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4);
}

.search-box input::placeholder {
  color: #999;
}

.search-box button {
  padding: 10px 24px;
  border: none;
  border-radius: 24px;
  background: #fff;
  color: #1a73e8;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.search-box button:hover {
  background: #e8f0fe;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 字母目录 */
.alphabet-nav {
  position: sticky;
  top: 74px;
  z-index: 99;
  background: #fff;
  padding: 12px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid #e8eaed;
}

.alpha-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: #1a73e8;
  background: #e8f0fe;
  user-select: none;
}

.alpha-item:hover {
  background: #1a73e8;
  color: #fff;
  transform: scale(1.1);
}

.alpha-item.selected {
  background: #1a73e8;
  color: #fff;
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.4);
}

.alpha-item.disabled {
  color: #ccc;
  background: #f5f5f5;
  cursor: default;
}

/* 加载提示 */
.loading-hint {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-size: 16px;
}

/* 空状态提示 */
.empty-hint {
  text-align: center;
  padding: 80px 20px;
  color: #999;
  font-size: 16px;
}

/* 字母标题中的词数 */
.letter-count {
  font-size: 14px;
  color: #999;
  font-weight: 400;
  margin-left: 6px;
}

/* 主内容区 */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

/* 字母分组 */
.letter-section {
  margin-bottom: 32px;
}

.letter-title {
  font-size: 28px;
  font-weight: 700;
  color: #1a73e8;
  padding: 8px 0 12px;
  border-bottom: 2px solid #e8f0fe;
  margin-bottom: 16px;
  letter-spacing: 1px;
}

/* 单词盒子 */
.word-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

/* 表头 */
.word-box::before {
  content: "";
  display: none;
}

.word-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid #f0f2f5;
  transition: background 0.15s;
}

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

.word-item:hover {
  background: #f8f9ff;
}

.word-item.highlight {
  background: #fff3cd;
  animation: highlightPulse 1.5s ease-in-out;
}

@keyframes highlightPulse {
  0%,
  100% {
    background: #fff3cd;
  }
  50% {
    background: #ffe8a1;
  }
}

.word-index {
  flex: 0 0 44px;
  font-size: 13px;
  color: #aaa;
  font-weight: 500;
  text-align: center;
}

.word-text {
  flex: 0 0 160px;
  font-weight: 700;
  font-size: 16px;
  color: #1a73e8;
}

.word-meaning {
  flex: 1;
  font-size: 15px;
  color: #555;
  padding: 0 16px;
}

.word-phonetic {
  flex: 0 0 160px;
  font-size: 13px;
  color: #999;
  font-style: italic;
  text-align: right;
}

/* 搜索结果浮动盒子 */
.search-result-box {
  position: fixed;
  top: 120px;
  right: 24px;
  z-index: 95;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  max-width: 300px;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: all 0.3s ease;
}

.search-result-box.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.result-label {
  font-size: 13px;
  color: #666;
  font-weight: 500;
}

.result-number {
  font-size: 16px;
  font-weight: 600;
  color: #1a73e8;
  line-height: 1.8;
  word-break: break-all;
}

.result-num-link {
  color: #1a73e8;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.15s;
}

.result-num-link:hover {
  background: #1a73e8;
  color: #fff;
}

.result-expand-link {
  color: #1a73e8;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  transition: all 0.15s;
  border: 1px dashed #1a73e8;
}

.result-expand-link:hover {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}

.result-switch-btn {
  padding: 6px 14px;
  margin-top: 6px;
  border: 1px solid #1a73e8;
  border-radius: 16px;
  background: #fff;
  color: #1a73e8;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  align-self: stretch;
}

.result-switch-btn:hover {
  background: #1a73e8;
  color: #fff;
}

/* 大弹窗遮罩 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-popup {
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 680px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
  transform: translateY(20px);
  transition: transform 0.25s;
}

.modal-overlay.show .modal-popup {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #eee;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #333;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #f0f2f5;
  color: #666;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
}

.modal-close:hover {
  background: #e74c3c;
  color: #fff;
}

.modal-body {
  overflow-y: auto;
  padding: 8px 24px 20px;
  flex: 1;
}

.modal-word-row {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
  gap: 12px;
}

.modal-word-row:hover {
  background: #f0f4ff;
}

.modal-word-row .mw-index {
  flex: 0 0 44px;
  color: #aaa;
  font-size: 13px;
  text-align: center;
}

.modal-word-row .mw-word {
  flex: 0 0 140px;
  font-weight: 700;
  color: #1a73e8;
  font-size: 15px;
}

.modal-word-row .mw-meaning {
  flex: 1;
  color: #555;
  font-size: 14px;
}

.modal-word-row .mw-phonetic {
  flex: 0 0 130px;
  color: #999;
  font-size: 12px;
  text-align: right;
  font-style: italic;
}

/* 响应式 */
@media (max-width: 640px) {
  .taskbar {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: none;
  }

  .alphabet-nav {
    top: 110px;
    padding: 10px 12px;
    gap: 4px;
  }

  .alpha-item {
    width: 30px;
    height: 30px;
    font-size: 12px;
    border-radius: 6px;
  }

  .container {
    padding: 16px 12px 40px;
  }

  .word-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .word-index {
    flex: none;
  }

  .word-text {
    flex: none;
  }

  .word-meaning {
    padding: 0;
  }

  .word-phonetic {
    flex: none;
    text-align: left;
  }

  .modal-popup {
    width: 95%;
    max-height: 90vh;
    border-radius: 12px;
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-word-row {
    flex-wrap: wrap;
    gap: 4px;
  }

  .modal-word-row .mw-word {
    flex: 0 0 100px;
  }

  .modal-word-row .mw-phonetic {
    flex: none;
    text-align: left;
  }

  .modal-body {
    padding: 8px 12px 16px;
  }

  .search-result-box {
    top: 150px;
    left: 10px;
    right: 10px;
    max-width: none;
    padding: 10px 14px;
    gap: 4px;
  }

  .search-result-box.show {
    transform: translateY(0);
  }

  .result-number {
    font-size: 14px;
  }
}
