:root {
  --primary-bg: #0a0a14;
  --secondary-bg: #1a1a2e;
  --card-bg: #252540;
  --accent: #d4af37;
  --accent-light: #e6c567;
  --text: #f5f5f7;
  --text-secondary: #a0a0b0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: linear-gradient(135deg, var(--primary-bg), #1c1c3a);

}

.container {
  max-width: 1600px;
  margin: 0 auto;
  color: var(--text);
}

header {
  text-align: center;
  padding: 30px 0;
  position: relative;
  margin-bottom: 40px;
}

header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 4px;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
  border-radius: 2px;
}

h1 {
  font-size: 3.5rem;
  margin-bottom: 15px;
  background: linear-gradient(to right, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

.subtitle {
  font-size: 1rem;
  margin: 0 auto;
  line-height: 1.7;
  color: var(--text-secondary);
}

.controls {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
  padding: 0 20px;
}

.search-container {
  position: relative;
  width: 400px;
}

.search-container input {
  width: 100%;
  padding: 12px 20px;
  border-radius: 30px;
  border: 2px solid #3a3a5a;
  background: var(--secondary-bg);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: all 0.3s;
}

.search-container input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}


.filters {
  display: flex;
  gap: 15px;
}

.filter-btn {
  padding: 10px 20px;
  background: var(--secondary-bg);
  border: 2px solid #3a3a5a;
  border-radius: 30px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent);
  color: var(--primary-bg);
  border-color: var(--accent);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 25px;
  padding: 0 20px;
}

.card {
  background: var(--card-bg);
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
  position: relative;
  height: 190px;
}

.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px rgba(212, 175, 55, 0.2);
}

.card-header {
  display: flex;
  align-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-emoji {
  font-size: 2.5rem;
  margin-right: 15px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 175, 55, 0.1);
  border-radius: 50%;
  border: 1px solid var(--accent);
  /* 防止变形 */
  flex-shrink: 0;
}

.card-title {
  font-size: 1.4rem;
  font-weight: 600;
}

.card-keywords {
  font-size: 0.9rem;
  color: var(--accent-light);
  margin-top: 3px;
}

.card-content {
  width: 100%;
  padding: 20px;
}

.card-content p {
  width: 100%;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  /* 添加多行文本截断 */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.card-type {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(212, 175, 55, 0.2);
  color: var(--accent-light);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.card-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 20, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s;
  padding: 20px;
}

.card-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--card-bg);
  width: 100%;
  max-width: 900px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  position: relative;
  top: 2vh;
}

.modal-header {
  padding: 15px;
  display: flex;
  align-items: center;
  background: linear-gradient(to right, rgba(26, 26, 46, 0.9), rgba(37, 37, 64, 0.85));
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-emoji {
  font-size: 3.5rem;
  margin-right: 25px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 175, 55, 0.15);
  border-radius: 50%;
  border: 2px solid var(--accent);
}

.modal-title {
  font-size: 2.2rem;
  font-weight: 600;
}

.modal-subtitle {
  display: flex;
  flex-wrap: wrap;
  font-size: 1.1rem;
  color: var(--accent-light);
  margin-top: 8px;
}

.modalKeywords #modalKeywords {
  margin-right: 20px;
}

.close-modal {
  position: absolute;
  top: 25px;
  right: 25px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.8rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s;
}

.close-modal:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent);
}

.modal-body {
  padding: 30px;
  line-height: 1.8;
}

.section-title {
  font-size: 1.4rem;
  color: var(--accent);
  margin: 25px 0 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.meaning-content {
  margin-bottom: 15px;
}

.keywords-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 15px 0;
}

.keyword {
  background: rgba(212, 175, 55, 0.1);
  color: var(--accent-light);
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
}

.reversed {
  background: rgba(255, 255, 255, 0.05);
  padding: 20px;
  border-radius: 10px;
  margin-top: 20px;
  border-left: 3px solid var(--accent);
}

footer {
  text-align: center;
  padding: 30px 0;
  margin-top: 40px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 1400px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* 模态框图片样式 */
.modal-img-container {
  text-align: center;
  margin-bottom: 20px;
}

.modal-img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
