:root {
  --head-offset: 238px;
  --preview-size: 82px;
  --bg-solid: #06133b;
  --panel: rgba(8, 22, 59, 0.72);
  --panel-strong: rgba(11, 28, 72, 0.86);
  --ink: #eef4ff;
  --muted: #9ab2df;
  --line: rgba(126, 163, 234, 0.25);
  --line-strong: rgba(146, 193, 255, 0.62);
  --accent: #8ab9ff;
  --accent-2: #7fe8ff;
  --card-shadow: 0 10px 22px rgba(2, 8, 24, 0.28);
}

* {
  box-sizing: border-box;
}

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

html {
  background: var(--bg-solid);
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  background: var(--bg-solid);
}

body::before {
  content: none;
}

.bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: var(--bg-solid);
  opacity: 1;
  z-index: -1;
}

.bg::before,
.bg::after {
  content: none;
}

/* Top fixed glow */
.app {
  z-index: 1;
}

.app {
  position: relative;
  max-width: 1320px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.app-head {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding-top: 10px;
  padding-bottom: 10px;
  background: linear-gradient(180deg, rgba(6, 19, 59, 0.98) 0%, rgba(6, 19, 59, 0.95) 72%, rgba(6, 19, 59, 0) 100%);
}

.app-head .top,
.app-head .controls {
  width: min(1320px, calc(100vw - 40px));
  margin-left: auto;
  margin-right: auto;
}

.top {
  padding: 4px 2px 10px;
}

.top h1 {
  margin: 0;
  font-size: clamp(34px, 4.4vw, 62px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-weight: 800;
  text-wrap: balance;
  color: #f4f8ff;
  text-shadow: 0 8px 24px rgba(77, 143, 255, 0.25);
}

.top p {
  margin: 11px 0 0;
  max-width: 780px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.controls {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(460px 120px at 50% -15%, rgba(155, 203, 255, 0.14), transparent 70%),
    linear-gradient(180deg, rgba(8, 20, 52, 0.78), rgba(5, 15, 40, 0.92));
  box-shadow: 0 6px 16px rgba(4, 10, 30, 0.24);
  padding: 14px;
  position: relative;
  z-index: 5;
}

.controls::after {
  content: none;
}

.tabs {
  display: inline-flex;
  gap: 8px;
  padding: 5px;
  border-radius: 12px;
  border: 1px solid rgba(122, 162, 236, 0.38);
  background: rgba(4, 10, 26, 0.66);
}

.tab {
  border: 0;
  border-radius: 9px;
  padding: 9px 16px;
  background: transparent;
  color: #a9bde0;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 0.16s ease, background-color 0.16s ease;
}

.tab:hover {
  color: #e1ecff;
}

.tab.active {
  color: #081424;
  background: linear-gradient(130deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 20px rgba(118, 176, 255, 0.35);
}

.search-wrap {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.search-wrap input {
  width: 100%;
  border-radius: 13px;
  border: 1px solid rgba(117, 154, 221, 0.35);
  background: rgba(2, 8, 23, 0.85);
  color: #f2f7ff;
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.search-wrap input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(127, 174, 255, 0.18);
}

#stats {
  color: #9db0d3;
  font-size: 13px;
}


.cards-pane {
  position: relative;
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
  padding: calc(var(--head-offset) + 14px) 24px 24px;
}

.cards-pane::before {
  content: none;
}

.grid {
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
  gap: 14px;
  padding-top: 0;
}

.card {
  min-height: 312px;
  height: 312px;
  position: relative;
  z-index: 1;
}

.download {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  text-align: left;
  border: 1px solid rgba(113, 151, 221, 0.33);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(10, 24, 60, 0.9), rgba(6, 17, 45, 0.96));
  color: var(--ink);
  padding: 12px 12px 12px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
  overflow: hidden;
  position: relative;
}

.download:hover {
  border-color: rgba(156, 202, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(142, 196, 255, 0.72), 0 12px 24px rgba(4, 14, 40, 0.34);
  transform: translateY(-1px);
}

.card:hover {
  z-index: 8;
}

.preview-wrap {
  position: relative;
  border-radius: 13px;
  border: 1px solid rgba(112, 152, 224, 0.28);
  background: radial-gradient(140px 120px at 50% 18%, rgba(125, 177, 255, 0.24), transparent 64%), #020d2d;
  width: 100%;
  height: 176px;
  display: grid;
  place-items: center;
}

.preview-wrap.no-lottie::after {
  content: attr(data-fallback-emoji);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 52px;
  line-height: 1;
  pointer-events: none;
}

.preview-wrap.reaction-idle::after {
  content: attr(data-fallback-emoji);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 58px;
  line-height: 1;
  pointer-events: none;
}

.preview-player {
  width: var(--preview-size);
  height: var(--preview-size);
  display: block;
  flex: 0 0 auto;
  contain: layout paint style;
  opacity: 1;
  visibility: hidden;
}

.preview-wrap.reaction-mode .preview-player {
  width: 75%;
  height: 75%;
}

.preview-player.hidden {
  display: none;
}

.preview-wrap.playing .preview-player {
  visibility: visible;
}

.meta {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
}

.title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #f0f6ff;
  min-height: 48px;
}


.hint {
  display: inline-flex;
  justify-self: start;
  align-self: flex-start;
  margin-top: auto;
  color: #d5e4ff;
  font-size: 11px;
  line-height: 1.2;
  border: 1px solid rgba(124, 162, 230, 0.45);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(16, 33, 70, 0.7);
  white-space: nowrap;
}

.sentinel {
  height: 1px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(2, 8, 23, 0.68);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(94vw, 560px);
  border: 1px solid rgba(126, 165, 236, 0.45);
  border-radius: 18px;
  background: rgba(9, 21, 53, 0.96);
  padding: 18px;
  position: relative;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.45);
  animation: fadeSlide 180ms ease both;
}

.modal-top {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 14px;
  align-items: start;
}

.modal-preview-wrap {
  width: 168px;
  height: 168px;
  border-radius: 14px;
  border: 1px solid rgba(108, 151, 228, 0.46);
  background: radial-gradient(circle at 50% 20%, rgba(49, 90, 162, 0.6) 0%, rgba(2, 21, 58, 0.9) 76%);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.modal-preview-player {
  width: 84px;
  height: 84px;
  margin: 0;
}

.modal-preview-wrap.reaction-mode .modal-preview-player {
  width: 126px;
  height: 126px;
  margin: 0;
}

.modal-headings {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 168px;
}

.modal-anim-name {
  margin: 0;
  color: #edf4ff;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.06;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: center;
}

.modal-actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.modal-btn {
  border: 1px solid rgba(122, 160, 230, 0.4);
  border-radius: 12px;
  padding: 12px 12px;
  background: rgba(15, 31, 66, 0.9);
  color: var(--ink);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.modal-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(138, 180, 255, 0.8);
  box-shadow: 0 8px 20px rgba(20, 44, 92, 0.42);
}

.modal-btn.primary {
  background: linear-gradient(130deg, var(--accent-2), var(--accent));
  color: #07131f;
  border-color: transparent;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(121, 157, 224, 0.42);
  border-radius: 999px;
  background: rgba(14, 29, 60, 0.9);
  color: var(--ink);
  cursor: pointer;
}

@media (max-width: 640px) {
  .modal-card {
    width: min(96vw, 420px);
    padding: 14px;
  }

  .modal-top {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .modal-preview-wrap {
    width: min(72vw, 220px);
    height: min(72vw, 220px);
    margin-inline: auto;
  }

  .modal-headings {
    min-height: auto;
    justify-content: center;
    text-align: center;
  }

  .modal-anim-name {
    font-size: 24px;
    text-align: center;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 800px) {
  .app {
    padding: 14px 10px 10px;
    min-height: 100vh;
  }

  .app-head {
    padding-top: 6px;
    padding-bottom: 8px;
  }

  .app-head .top,
  .app-head .controls {
    width: calc(100vw - 20px);
  }

  .cards-pane {
    padding-bottom: 8px;
  }

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

  .card {
    min-height: 296px;
    height: 296px;
  }

  .preview-wrap {
    height: 166px;
  }

  .title {
    font-size: 14px;
    line-height: 1.18;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

}

.origin-emoji {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-size: 20px;
  line-height: 1;
  background: transparent;
  border: 0;
  box-shadow: none;
}
