:root {
  color-scheme: light;
  --paper: #fbf7ef;
  --panel: #ffffff;
  --ink: #16201d;
  --muted: #65706b;
  --line: #e7ded1;
  --mint: #16a085;
  --coral: #ef6f5e;
  --gold: #d89b26;
  --blue: #3366cc;
  --shadow: 0 18px 50px rgba(28, 31, 29, 0.11);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Arial,
    "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(251, 247, 239, 0.72) 38rem),
    var(--paper);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0;
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(22, 32, 29, 0.08);
}

.language-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.language-picker select {
  min-width: 8.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0.62rem 0.7rem;
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(18rem, 1fr);
  gap: clamp(1rem, 4vw, 3rem);
  align-items: end;
  padding: clamp(2.25rem, 7vw, 5.5rem) 0 1.4rem;
}

.eyebrow {
  margin: 0 0 0.6rem;
  color: var(--coral);
  font-weight: 800;
  letter-spacing: 0;
}

.hero h1 {
  margin: 0;
  font-size: clamp(3rem, 7vw, 6.4rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.hero p {
  max-width: 40rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.7;
}

.search-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.search-box {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  color: var(--muted);
}

.search-box span {
  width: 2.4rem;
  text-align: center;
  color: var(--blue);
  font-size: 1.2rem;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  padding: 0.9rem 0.2rem;
}

.search-box input::placeholder {
  color: #8c9691;
}

.primary-button,
.ghost-button {
  min-height: 2.7rem;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.64rem 0.95rem;
  cursor: pointer;
  font-weight: 750;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.primary-button {
  background: var(--ink);
  color: #fff;
}

.ghost-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.primary-button:hover,
.ghost-button:hover,
.emoji-card:hover,
.category-button:hover {
  transform: translateY(-1px);
}

.ad-band {
  height: 90px !important;
  min-height: 90px !important;
  max-height: 90px !important;
  margin: 1rem 0 1.35rem;
  border-block: 1px solid var(--line);
  padding: 0;
  overflow: hidden !important;
  transition:
    height 180ms ease,
    min-height 180ms ease,
    margin 180ms ease,
    padding 180ms ease,
    opacity 180ms ease;
}

.ad-band.ad-empty {
  height: 12px !important;
  min-height: 12px !important;
  max-height: 12px !important;
  margin: 0.45rem 0 0.7rem;
  padding: 0;
  opacity: 0.45;
}

.ad-band.ad-filled {
  height: 90px !important;
  min-height: 90px !important;
  max-height: 90px !important;
  opacity: 1;
}

.adsbygoogle {
  height: 90px !important;
  min-height: 90px;
  max-height: 90px;
  overflow: hidden;
}

.workspace {
  display: grid;
  grid-template-columns: 16.5rem minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 5.2rem;
  display: grid;
  gap: 1rem;
  max-height: calc(100vh - 6rem);
  overflow: auto;
  padding-bottom: 1rem;
}

.quick-tabs,
.categories {
  display: grid;
  gap: 0.45rem;
}

.category-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 0.65rem 0.75rem;
  text-align: start;
  cursor: pointer;
}

.category-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-button span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.86rem;
}

.category-button.active {
  border-color: rgba(22, 160, 133, 0.55);
  background: #e8f8f4;
  color: #0b5b4c;
}

.results {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: clamp(0.75rem, 2vw, 1rem);
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.results-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.results-head p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.4rem, 1fr));
  gap: 0.65rem;
  min-height: 16rem;
}

.emoji-card {
  position: relative;
  display: grid;
  grid-template-rows: 3.8rem 2.7rem 1.3rem;
  gap: 0.35rem;
  min-width: 0;
  min-height: 9.1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0.7rem;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(22, 32, 29, 0.06);
}

.emoji-symbol {
  display: grid;
  place-items: center;
  font-size: 2.35rem;
  line-height: 1;
}

.emoji-name {
  display: -webkit-box;
  overflow: hidden;
  color: #29342f;
  font-size: 0.86rem;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.emoji-code {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-toggle {
  position: absolute;
  top: 0.38rem;
  inset-inline-end: 0.38rem;
  display: grid;
  width: 1.85rem;
  height: 1.85rem;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: rgba(251, 247, 239, 0.9);
  color: #a26b00;
  cursor: pointer;
}

.favorite-toggle.active {
  background: #fff2c9;
}

.empty {
  margin: 3rem 0;
  color: var(--muted);
  text-align: center;
}

.emoji-dialog {
  width: min(31rem, calc(100% - 2rem));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.emoji-dialog::backdrop {
  background: rgba(22, 32, 29, 0.38);
  backdrop-filter: blur(3px);
}

.dialog-close {
  position: absolute;
  top: 0.7rem;
  inset-inline-end: 0.7rem;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.dialog-symbol {
  margin-top: 0.75rem;
  font-size: 5.2rem;
  text-align: center;
}

.emoji-dialog h2 {
  margin: 0.4rem 2rem 1rem;
  text-align: center;
}

.emoji-dialog dl {
  display: grid;
  gap: 0.65rem;
  margin: 0 0 1rem;
}

.emoji-dialog dl div {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.65rem;
}

.emoji-dialog dt {
  color: var(--muted);
}

.emoji-dialog dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.dialog-actions {
  display: flex;
  gap: 0.6rem;
}

.dialog-actions button {
  flex: 1;
}

.toast {
  position: fixed;
  inset-inline: 50% auto;
  bottom: 1.25rem;
  z-index: 30;
  transform: translate(-50%, 1rem);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1rem;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

[dir="rtl"] .toast {
  transform: translate(50%, 1rem);
}

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

[dir="rtl"] .toast.show {
  transform: translate(50%, 0);
}

footer {
  width: min(1180px, calc(100% - 2rem));
  margin: 2rem auto 0;
  border-top: 1px solid var(--line);
  padding: 1.25rem 0 2rem;
  color: var(--muted);
}

footer p {
  margin: 0.25rem 0;
}

@media (max-width: 880px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 1.5rem;
  }

  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .quick-tabs,
  .categories {
    grid-auto-flow: column;
    grid-auto-columns: minmax(9rem, 1fr);
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .language-picker,
  .language-picker select {
    width: 100%;
  }

  .search-panel,
  .results-head,
  .dialog-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .hero h1 {
    font-size: 3rem;
  }

  .emoji-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ad-band,
  .ad-band.ad-filled,
  .adsbygoogle {
    height: 72px !important;
    min-height: 72px !important;
    max-height: 72px !important;
  }

  .ad-band.ad-empty {
    height: 8px !important;
    min-height: 8px !important;
    max-height: 8px !important;
  }
}
