* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  :root {
    --primary: #3498db;
    --primary-light: #5dade2;
    --primary-dark: #2980b9;
    --bg: #f5fbff;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #666;
    --gray: #95a5a6;
    --border: #e1f0fa;
    --hover-bg: #f0f8ff;
  }
  
  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f0f7ff, #e3f2fd);
    color: var(--text);
    padding: 20px;
    line-height: 1.5;
  }
  
  header {
    text-align: center;
    margin-bottom: 28px;
  }
  
  h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
    color: var(--primary-dark);
  }
  
  .subtitle {
    color: var(--gray);
    font-size: 1rem;
  }
  
  .search-box {
    max-width: 600px;
    margin: 0 auto 28px;
  }
  
  #searchInput {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    outline: none;
    background-color: var(--card-bg);
    transition: border-color 0.3s, box-shadow 0.3s;
  }
  
  #searchInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
  }
  
  /* ===== 核心：9宫格默认撑满无间隙 ===== */
  .categories {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    width: 100%;
  }
  
  /* 搜索时：临时单列居中 */
  .searching .categories {
    grid-template-columns: 1fr !important;
    justify-items: center;
  }
  
  footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
    font-size: 0.9rem;
  }
  
  footer a,
  footer a:visited,
  footer a:hover,
  footer a:active {
    color: var(--text-light);
    text-decoration: none;
  }

  @media (max-width: 900px) {
    .categories {
      grid-template-columns: 1fr;
    }
  }
  
  .category {
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(52, 152, 219, 0.08);
    overflow: hidden;
    transition: transform 0.2s;
  }
  
  .category:hover {
    transform: translateY(-2px);
  }
  
  .category-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 16px 24px;
    font-weight: 600;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
  }
  
  .category-header::before {
    display: inline-block;
    width: 24px;
    height: 24px;
    margin-right: 10px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
  }
  
  .emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 6px;
    padding: 16px;
  }
  
  .emoji-item {
    width: 56px;
    height: 56px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
    position: relative;
    background: transparent;
  }
  
  .emoji-item:hover {
    background-color: var(--hover-bg);
    transform: scale(1.2);
    z-index: 5;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
  }
  
  .emoji-item.copied {
    animation: copied 0.6s ease forwards;
  }
  
  @keyframes copied {
    0% { transform: scale(1); }
    50% { transform: scale(1.4) rotate(8deg); background-color: #e8f4fc; }
    100% { transform: scale(1); }
  }
  
  /* ===== Toast 修复：确保显示 ===== */
  #toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--primary);
    color: white;
    padding: 14px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4);
    transform: translateX(200%);
    opacity: 0;
    transition: 
      transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
      opacity 0.3s ease;
    z-index: 9999;
    display: flex;
    align-items: center;
    pointer-events: none;
  }
  
  #toast::before {
    content: '✔';
    margin-right: 8px;
    background: white;
    color: var(--primary);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
  }
  
  #toast.show {
    transform: translateX(0);
    opacity: 1;
  }
  
  /* ===== 搜索结果专属样式 ===== */
  .search-result-category {
    width: 100%;
    max-width: 800px;
  }
  
  .search-suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
    padding: 24px 20px;
    color: #7f8c8d;
    font-size: 1rem;
    line-height: 1.6;
  }
  
  .search-suggestions > span {
    white-space: nowrap;
  }
  
  .suggestion {
    background: rgba(52, 152, 219, 0.08);
    color: var(--primary-dark);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
  }
  
  .suggestion:hover {
    background: rgba(52, 152, 219, 0.15);
  }
  
  /* 手机端适配 */
  @media (max-width: 600px) {
    .emoji-grid {
      grid-template-columns: repeat(5, 1fr);
      gap: 3px;
      padding: 10px;
    }
  
    .emoji-item {
      font-size: 1.3rem;
      width: 50px;
      height: 50px;
    }
  
    h1 {
      font-size: 1.8rem;
    }
  
    #toast {
      top: 15px;
      right: 15px;
      padding: 12px 20px;
      font-size: 0.95rem;
    }
  
    .search-suggestions {
      padding: 20px 15px;
    }
  }