/* ===== 小升初必备英语单词汇总（带音标） - 朗读学习工具 ===== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --secondary: #059669;
  --secondary-hover: #047857;
  --secondary-light: #ecfdf5;
  --warn: #d97706;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
}

.hidden { display: none !important; }

/* App Container */
.xsc-app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.xsc-header {
  text-align: center;
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 12px;
}

.xsc-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.xsc-header p {
  color: var(--gray-500);
  font-size: 0.9rem;
}

.xsc-header span {
  display: block;
  text-align: center;
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--gray-400);
}

.xsc-header span a { color: var(--primary); }

/* Toolbar */
.xsc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  margin-bottom: 12px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toolbar-search {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 420px;
}

.toolbar-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--gray-800);
  outline: none;
  transition: border-color 0.15s;
}

.toolbar-search input:focus { border-color: var(--primary); }

.toolbar-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-info {
  font-size: 0.82rem;
  color: var(--gray-500);
}

.seq-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.seq-btn:hover { background: var(--primary-hover); }

.seq-btn.stop { background: #ef4444; }
.seq-btn.stop:hover { background: #dc2626; }

/* TTS not supported notice */
.tts-warn {
  padding: 10px 16px;
  margin-bottom: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  color: var(--warn);
  font-size: 0.85rem;
  text-align: center;
}

/* Main layout */
.xsc-main {
  display: flex;
  gap: 12px;
  flex: 1;
  align-items: flex-start;
}

/* Sidebar */
.section-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}

.sidebar-stats {
  font-size: 0.78rem;
  color: var(--gray-500);
  padding: 4px 6px 10px;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 8px;
}

.section-nav { list-style: none; }

.section-nav li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}

.section-nav li:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.section-nav li.active {
  background: var(--primary);
  color: #fff;
}

.section-nav .sec-count {
  flex-shrink: 0;
  font-size: 0.72rem;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--gray-100);
  color: var(--gray-500);
}

.section-nav li.active .sec-count {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

/* Content */
.word-content {
  flex: 1;
  min-width: 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-100);
}

.content-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gray-900);
}

.content-header .sec-range {
  font-size: 0.8rem;
  color: var(--gray-400);
  font-weight: 400;
}

.word-list { padding: 6px 0; }

.word-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--gray-50);
  transition: background 0.15s;
}

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

.word-row:hover { background: var(--gray-50); }

.word-row.speaking {
  background: var(--primary-light);
  box-shadow: inset 3px 0 0 var(--primary);
}

.word-num {
  flex-shrink: 0;
  width: 38px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  background: var(--gray-100);
  border-radius: 13px;
  font-variant-numeric: tabular-nums;
}

.word-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.word-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.word-en {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-900);
  cursor: pointer;
}

.word-ipa {
  font-size: 0.85rem;
  color: var(--gray-400);
  font-family: "Segoe UI", "Times New Roman", "Noto Sans", sans-serif;
  letter-spacing: 0.3px;
}

.word-zh {
  font-size: 0.88rem;
  color: var(--gray-500);
  cursor: pointer;
}

/* Speaker buttons */
.speak-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  padding: 2px 9px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.5;
}

.speak-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.speak-btn.zh:hover {
  border-color: var(--secondary);
  color: var(--secondary);
}

.speak-btn svg {
  width: 12px;
  height: 12px;
}

.speak-btn.playing {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  animation: pulse 1s ease-in-out infinite;
}

.speak-btn.zh.playing {
  border-color: var(--secondary);
  background: var(--secondary);
}

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

/* Search results */
.search-tag {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--gray-400);
  background: var(--gray-100);
  border-radius: 4px;
  padding: 0 6px;
  margin-left: 6px;
  font-weight: 400;
}

.search-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--gray-400);
  font-size: 0.9rem;
}

.search-empty .empty-icon { font-size: 2rem; margin-bottom: 8px; }

/* 工具导航、友情链接、footer 样式沿用公共 css/style.css，与其它工具页保持一致 */

/* Responsive */
@media (max-width: 860px) {
  .xsc-main { flex-direction: column; }

  .section-sidebar {
    position: static;
    width: 100%;
    max-height: none;
    padding: 10px;
  }

  .sidebar-stats { display: none; }

  .section-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .section-nav li {
    flex-shrink: 0;
    padding: 7px 12px;
    white-space: nowrap;
  }

  .section-nav .sec-count { display: none; }

  .word-row { padding: 10px 12px; }

  .word-en { font-size: 0.98rem; }

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