:root {
  color-scheme: light;
  --bg: #fff;
  --ink: #111;
  --muted: #8b8b8b;
  --hover: #f5f5f5;
  --focus: #ececec;
  font-family:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  display: flex;
  flex-direction: column;
  width: min(100%, 900px);
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(14px, 3vw, 28px);
}

.search {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0 0 18px;
  padding: 6px 0 10px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.search input {
  width: 100%;
  height: 36px;
  border: 1px solid #e2e2e2;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  letter-spacing: 0;
  outline: none;
  padding: 0 9px;
}

.search input::placeholder {
  color: #aaa;
}

.selected-meaning {
  min-height: 18px;
  margin: -8px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.shelf {
  display: grid;
  gap: 24px;
}

.lane {
  display: grid;
  gap: 7px;
}

.lane h2,
.result-meta {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
}

.emoji-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  min-height: 40px;
}

.results {
  display: none;
  gap: 8px;
}

.results.is-active {
  display: grid;
}

.result-meta {
  min-height: 16px;
}

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

.emoji-button {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  transition:
    background 90ms ease,
    transform 90ms ease,
    opacity 90ms ease;
}

.emoji-grid .emoji-button {
  width: 100%;
}

.emoji-button:hover,
.emoji-button:focus-visible {
  background: var(--hover);
  outline: none;
}

.emoji-button.is-active,
.emoji-button.is-focus {
  background: var(--focus);
}

.emoji-button.is-copied {
  background: #f0f0f0;
}

.emoji-button.pop {
  animation: copied 130ms ease;
}

.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 10px 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 20;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 120ms ease, transform 120ms ease;
  backdrop-filter: blur(12px);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.credit {
  margin-top: auto;
  padding-top: 28px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.credit a {
  color: inherit;
  text-decoration: none;
}

.credit a:hover,
.credit a:focus-visible {
  color: var(--ink);
  outline: none;
}

@keyframes copied {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.92);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 620px) {
  .shell {
    padding: 12px;
  }

  .search {
    margin-bottom: 16px;
    padding-top: 2px;
  }

  .search input {
    width: 100%;
    height: 34px;
    font-size: 17px;
  }

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

  .emoji-button {
    min-width: 38px;
    height: 38px;
    font-size: 23px;
  }
}

@media (max-width: 380px) {
  .emoji-grid {
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  }

  .emoji-button {
    min-width: 36px;
    height: 36px;
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
