*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #0f1117;
  color: #e1e4ea;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.6;
}
.container { max-width: 900px; width: 100%; padding: 0 1rem; }

nav {
  width: 100%;
  background: #1a1d28;
  border-bottom: 1px solid #2a2d3a;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}
nav a {
  color: #8b8fa3;
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
}
nav a:hover { color: #e1e4ea; background: #2a2d3a; }
nav a.active { color: #fc5c7d; background: #2a2d3a; }

header { text-align: center; padding: 2rem 0 1.5rem; }
header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f0c27f, #fc5c7d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}
header p { margin-top: 0.25rem; color: #8b8fa3; font-size: 1rem; }

.card {
  background: #1a1d28;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid #2a2d3a;
}
.section-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
  color: #c8cbd8;
}

/* Search */
.search-box {
  position: relative;
  margin-bottom: 1rem;
}
.search-box input {
  width: 100%;
  padding: 0.9rem 1rem 0.9rem 2.8rem;
  border: 1px solid #2a2d3a;
  border-radius: 10px;
  background: #0f1117;
  color: #e1e4ea;
  font-size: 1.05rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus { border-color: #fc5c7d; }
.search-box input::placeholder { color: #5a5e72; }
.search-box .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #5a5e72;
  font-size: 1.1rem;
}

/* Emoji grid */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0.5rem;
}
.emoji-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: #1a1d28;
  border: 1px solid #2a2d3a;
  border-radius: 10px;
  padding: 0.75rem 0.5rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.1s;
}
.emoji-card:hover { border-color: #fc5c7d; transform: translateY(-2px); }
.emoji-card .emoji-char { font-size: 2rem; line-height: 1; }
.emoji-card .emoji-name { font-size: 0.65rem; color: #8b8fa3; text-align: center; word-break: break-word; }

/* Emoji detail */
#emoji-detail { display: none; }
#emoji-detail.visible { display: block; }
.detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.detail-header .big-emoji { font-size: 4rem; line-height: 1; }
.detail-header .detail-info h2 { font-size: 1.3rem; color: #e1e4ea; }
.detail-header .detail-info .detail-unicode { color: #6b6f83; font-size: 0.85rem; font-family: monospace; }
.detail-prop { margin-bottom: 0.5rem; }
.detail-prop .label { color: #6b6f83; font-size: 0.8rem; display: block; }
.detail-prop .value { color: #e1e4ea; font-size: 0.95rem; }
.detail-prop .value.meaning { color: #a8acc1; }
.copy-emoji-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: #2a2d3a;
  border: 1px solid #2a2d3a;
  border-radius: 8px;
  color: #e1e4ea;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.copy-emoji-btn:hover { border-color: #fc5c7d; }
.detail-examples { margin-top: 0.5rem; }
.detail-examples .label { color: #6b6f83; font-size: 0.8rem; display: block; margin-bottom: 0.3rem; }
.detail-examples .examples { color: #a8acc1; font-size: 0.9rem; }

/* Content pages */
.content p { margin-bottom: 1rem; color: #a8acc1; font-size: 0.95rem; }
.content h2 { color: #c8cbd8; font-size: 1.2rem; margin: 1.5rem 0 0.75rem; }
.content h3 { color: #c8cbd8; font-size: 1.05rem; margin: 1.2rem 0 0.5rem; }
.content ul { margin: 0.5rem 0 1rem 1.5rem; color: #a8acc1; font-size: 0.95rem; }
.content ul li { margin-bottom: 0.35rem; }

/* Category list */
.cat-section { margin-bottom: 1.5rem; }
.cat-title {
  font-size: 1rem;
  font-weight: 600;
  color: #f0c27f;
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #2a2d3a;
}
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.3rem;
}
.cat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: #1a1d28;
  border: 1px solid #2a2d3a;
  cursor: pointer;
  transition: border-color 0.2s;
  font-size: 0.85rem;
}
.cat-item:hover { border-color: #fc5c7d; }
.cat-item .ci-emoji { font-size: 1.3rem; }
.cat-item .ci-name { color: #a8acc1; font-size: 0.8rem; }

/* Quiz */
.quiz-area { text-align: center; margin-top: 0.75rem; }
.quiz-emoji { font-size: 5rem; margin-bottom: 0.5rem; }
.quiz-input {
  padding: 0.6rem 1rem;
  border: 1px solid #2a2d3a;
  border-radius: 8px;
  background: #0f1117;
  color: #e1e4ea;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  width: 250px;
  text-align: center;
}
.quiz-input:focus { border-color: #fc5c7d; }
.quiz-result { margin-top: 0.5rem; font-size: 0.9rem; min-height: 1.5rem; }
.quiz-score { font-size: 0.85rem; color: #6b6f83; margin-top: 0.3rem; }
.quiz-controls { display: flex; gap: 0.5rem; justify-content: center; margin-top: 0.5rem; }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 1rem; border-bottom: 1px solid #2a2d3a; }

/* Category cards */
.category-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}
.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  background: #1a1d28;
  border: 1px solid #2a2d3a;
  border-radius: 12px;
  padding: 1rem 0.5rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.category-card:hover { border-color: #fc5c7d; transform: translateY(-2px); }
.category-card .cat-emoji { font-size: 2rem; line-height: 1; }
.category-card .cat-name { font-size: 0.8rem; font-weight: 600; color: #e1e4ea; }
.category-card .cat-count { font-size: 0.65rem; color: #6b6f83; }
.tab {
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  color: #6b6f83;
  font-size: 0.85rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.tab:hover { color: #a8acc1; }
.tab.active { color: #fc5c7d; border-bottom-color: #fc5c7d; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid #2a2d3a;
  border-radius: 8px;
  background: #1a1d28;
  color: #e1e4ea;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.btn:hover { border-color: #fc5c7d; background: #2a2d3a; }

footer { text-align: center; padding: 2rem 0; color: #3a3d4a; font-size: 0.85rem; margin-top: auto; }

/* Popup */
.popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  justify-content: center;
  align-items: center;
  z-index: 100;
}
.popup-overlay.open { display: flex; }

.popup-card {
  background: #1a1d28;
  border: 1px solid #2a2d3a;
  border-radius: 16px;
  padding: 2rem;
  width: 90%;
  max-width: 360px;
  text-align: center;
  position: relative;
  animation: popIn 0.2s ease;
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.popup-close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: #6b6f83;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
}
.popup-close:hover { color: #e1e4ea; }

.popup-emoji { font-size: 4rem; line-height: 1.2; margin-bottom: 0.5rem; }
.popup-name { font-size: 1.2rem; font-weight: 700; color: #e1e4ea; margin-bottom: 0.3rem; }
.popup-unicode { font-size: 0.8rem; color: #6b6f83; font-family: monospace; margin-bottom: 0.5rem; }
.popup-category {
  display: inline-block;
  font-size: 0.7rem;
  color: #fc5c7d;
  background: rgba(252,92,125,0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  margin-bottom: 0.7rem;
}
.popup-alias {
  font-size: 0.8rem;
  color: #6b6f83;
  font-family: monospace;
  margin-bottom: 0.7rem;
  min-height: 1.2rem;
}
.popup-meaning { font-size: 0.9rem; color: #a8acc1; margin-bottom: 0.5rem; line-height: 1.5; }
.popup-examples {
  font-size: 0.85rem;
  color: #6b6f83;
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: #0f1117;
  border-radius: 8px;
  line-height: 1.5;
}

.popup-copy {
  padding: 0.6rem 1.5rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #fc5c7d, #f06);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
}
.popup-copy:hover { opacity: 0.9; }

/* Mobile */
@media (max-width: 600px) {
  header h1 { font-size: 1.6rem; }
  nav a { font-size: 0.8rem; padding: 0.4rem 0.6rem; }
  .emoji-grid { grid-template-columns: repeat(9, 1fr); gap: 0.3rem; }
  .emoji-card .emoji-char { font-size: 1.3rem; }
  .emoji-card { padding: 0.4rem 0.2rem; }
  .emoji-card .emoji-name { font-size: 0.5rem; }
  .popup-card { padding: 1.5rem; }
  .popup-emoji { font-size: 3rem; }
}
