:root {
  color-scheme: light dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--gray-1);
}

button,
input {
  font: inherit;
}

.rt-Theme {
  min-height: 100vh;
}

.app-shell {
  min-height: 100vh;
  background:
    linear-gradient(180deg, var(--accent-2), transparent 230px),
    var(--gray-1);
}

.container {
  width: min(100% - 32px, 1180px);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--gray-a5);
  /* Solid (opaque) background instead of a translucent one + backdrop-filter:
     blur(). A backdrop-filter forces the compositor to re-sample and blur
     everything behind the sticky bar on every frame the content underneath
     changes — expensive when the emoji grid below is large and scrolling. */
  background: var(--gray-1);
}

.topbar-inner {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(260px, 520px) auto;
  gap: 16px;
  align-items: center;
  min-height: 64px;
}

.topbar-actions {
  display: flex;
  justify-self: end;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--accent-a6);
  border-radius: 8px;
  background: var(--accent-a3);
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 22px;
}

.search-input {
  min-width: 0;
  width: 100%;
}

.category-nav-wrap {
  padding-top: 14px;
  padding-bottom: 18px;
}

.category-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 8px;
  scrollbar-width: thin;
}

.category-chip {
  flex: 0 0 auto;
}

.category-chip[data-active="true"] {
  box-shadow: 0 0 0 1px var(--accent-a8);
}

.content {
  padding: 4px 0 56px;
}

.emoji-section {
  scroll-margin-top: 94px;
  padding-top: 22px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
}

.emoji-card {
  min-width: 0;
  border: 1px solid var(--gray-a5);
  border-radius: 8px;
  background: color-mix(in srgb, var(--gray-1) 88%, var(--accent-2));
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.emoji-card:hover,
.emoji-card:focus-within {
  border-color: var(--accent-a8);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--gray-12) 10%, transparent);
  transform: translateY(-1px);
}

.emoji-card:focus-within {
  outline: none;
}

.emoji-button:focus-visible {
  outline: 2px solid var(--accent-8);
  outline-offset: -4px;
}

.emoji-button {
  display: grid;
  width: 100%;
  min-height: 108px;
  grid-template-rows: 44px minmax(32px, auto) 18px;
  gap: 8px;
  align-items: start;
  justify-items: center;
  padding: 12px 8px 10px;
  border: 0;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.emoji-glyph {
  height: 44px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 36px;
  line-height: 1;
}

.emoji-name {
  display: -webkit-box;
  width: 100%;
  min-height: 32px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--gray-12);
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  overflow-wrap: anywhere;
}

.emoji-subgroup {
  width: 100%;
  overflow: hidden;
  color: var(--gray-10);
  font-size: 11px;
  line-height: 14px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  min-height: 280px;
  place-items: center;
  border: 1px dashed var(--gray-a6);
  border-radius: 8px;
  color: var(--gray-11);
  text-align: center;
}

.copied-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 36px));
  border: 1px solid var(--accent-a6);
  border-radius: 8px;
  background: var(--accent-3);
  box-shadow: 0 14px 36px color-mix(in srgb, var(--gray-12) 18%, transparent);
}

@media (max-width: 760px) {
  .container {
    width: min(100% - 24px, 1180px);
  }

  .topbar-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    min-height: 0;
    padding: 10px 0;
  }

  .topbar-inner > .rt-Flex:first-child {
    grid-column: 1 / -1;
  }

  .topbar-actions {
    grid-column: 2;
    grid-row: 2;
  }

  .search-input {
    grid-column: 1;
    grid-row: 2;
  }

  .emoji-grid {
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 8px;
  }

  .emoji-button {
    min-height: 100px;
    padding-inline: 6px;
  }

  .emoji-glyph {
    font-size: 32px;
  }
}
