/* Speaking — topic library index (v3) */

.speaking-main { max-width: 1200px; }

/* ---------- Search ---------- */
.search-row { margin-bottom: 20px; }
.search-box {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  background: #ffffff;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 14px;
  max-width: 640px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within {
  border-color: #2c6cf6;
  box-shadow: 0 0 0 3px rgba(44,108,246,0.12);
}
.search-box svg { color: #94a3b8; flex-shrink: 0; }
#searchInput {
  flex: 1; border: none; outline: none;
  font-family: inherit; font-size: 14px;
  color: #1f2937; background: transparent;
}
#searchInput::placeholder { color: #94a3b8; }
.search-clear {
  background: #f1f5f9;
  border: none; width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 14px; font-weight: 700; color: #6b7280;
  cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
}
.search-clear:hover { background: #e2e8f0; color: #1f2937; }

/* ---------- Global search results ---------- */
.global-search-results {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px 18px;
  border: 1px solid #f1f5f9;
  margin-bottom: 20px;
}
.gsr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.gsr-title { font-size: 15px; font-weight: 700; color: #111827; }
.gsr-count { font-size: 12px; color: #94a3b8; font-weight: 500; margin-left: 8px; }
.gsr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.gsr-item {
  display: flex; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: #f8fafc;
  text-decoration: none; color: inherit;
  transition: all 0.15s; border: 1px solid transparent;
}
.gsr-item:hover { background: #ffffff; border-color: #c7d2fe; transform: translateY(-1px); }
.gsr-emoji {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 18px; flex-shrink: 0;
}
.gsr-body { flex: 1; min-width: 0; }
.gsr-en { font-size: 13.5px; font-weight: 600; color: #1f2937; line-height: 1.5; }
.gsr-cn { font-size: 12px; color: #6b7280; line-height: 1.5; margin-top: 2px; }
.gsr-where { font-size: 10.5px; color: #94a3b8; margin-top: 4px; }
.gsr-type {
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 4px;
  margin-right: 4px;
}
.gsr-type.type-vocab { background: #eff6ff; color: #1d4ed8; }
.gsr-type.type-phrase { background: #fef3c7; color: #92400e; }
.gsr-type.type-pattern { background: #f0fdf4; color: #15803d; }
.gsr-more { padding: 10px; text-align: center; color: #94a3b8; font-size: 12px; grid-column: 1 / -1; }
mark { background: #fef08a; color: #713f12; padding: 0 2px; border-radius: 3px; }

/* ---------- Topics grid ---------- */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.topic-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px 18px;
  border: 1px solid #f1f5f9;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}
.topic-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--topic-color, #2c6cf6);
  opacity: 0.6;
}
.topic-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(15,23,42,0.08);
  border-color: var(--topic-color, #c7d2fe);
}
.topic-card:hover::before { opacity: 1; height: 5px; }

.tc-head {
  display: flex; align-items: center; gap: 12px;
}
.tc-emoji {
  font-size: 28px;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
}
.tc-meta { flex: 1; min-width: 0; }
.tc-name-cn { font-size: 16px; font-weight: 700; color: #111827; }
.tc-name-en { font-size: 12px; color: #94a3b8; font-weight: 500; margin-top: 2px; letter-spacing: 0.3px; }
.tc-level {
  font-size: 11px; font-weight: 700;
  background: #d1fae5; color: #047857;
  padding: 2px 8px; border-radius: 999px;
  flex-shrink: 0;
}
.tc-desc {
  font-size: 13px; color: #4b5563; line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.tc-progress { margin-top: auto; }
.tc-progress-bar {
  height: 6px; background: #f1f5f9;
  border-radius: 999px; overflow: hidden;
  margin-bottom: 4px;
}
.tc-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}
.tc-progress-text {
  display: flex; justify-content: space-between;
  font-size: 11.5px; color: #6b7280;
  font-variant-numeric: tabular-nums;
}
.tc-progress-text b { color: #1f2937; font-weight: 700; }
.tc-progress-pct { font-weight: 600; color: var(--topic-color, #2c6cf6); }

@media (max-width: 600px) {
  .topics-grid { grid-template-columns: 1fr; }
  .gsr-list { grid-template-columns: 1fr; }
}

/* ---------- Toast (shared) ---------- */
.toast-pop {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f2937; color: #ffffff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(15,23,42,0.4);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s ease;
  z-index: 3000;
}
.toast-pop.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
