:root {
  color-scheme: dark;
  --bg: #07090f;
  --panel: #111620;
  --panel-strong: #171d29;
  --text: #f6f7fb;
  --muted: #a9b0c2;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #2ee6a6;
  --accent-2: #ffcf5a;
  --accent-3: #ff6b9a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(46, 230, 166, 0.18), transparent 28rem),
    radial-gradient(circle at 86% 10%, rgba(255, 107, 154, 0.18), transparent 30rem),
    linear-gradient(135deg, #07090f 0%, #0b1018 46%, #06080d 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  min-height: clamp(420px, 58vh, 620px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 460px);
  gap: 36px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(4rem, 11vw, 8.8rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.subtitle {
  max-width: 640px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.3rem);
  line-height: 1.65;
}

.hero-preview {
  position: relative;
  min-height: 390px;
}

.preview-card {
  position: absolute;
  width: min(72%, 330px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
  background-size: cover;
  animation: floaty 7s ease-in-out infinite;
}

.preview-card-one {
  top: 0;
  right: 18px;
  transform: rotate(5deg);
}

.preview-card-two {
  left: 0;
  top: 112px;
  transform: rotate(-7deg);
  animation-delay: -2.1s;
}

.preview-card-three {
  right: 0;
  bottom: 0;
  transform: rotate(3deg);
  animation-delay: -4.3s;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  margin: 0 0 10px;
  background: rgba(7, 9, 15, 0.84);
  backdrop-filter: blur(16px);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-button,
.shuffle-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.filter-button {
  padding: 0 16px;
}

.shuffle-button {
  flex: 0 0 auto;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--accent), #57a8ff);
  color: #061015;
  border-color: transparent;
}

.filter-button:hover,
.shuffle-button:hover {
  transform: translateY(-2px);
}

.filter-button.is-active {
  background: rgba(46, 230, 166, 0.16);
  border-color: rgba(46, 230, 166, 0.72);
  color: #dffdf3;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.gallery-sentinel {
  height: 1px;
}

.image-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 22, 32, 0.82);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
  animation: reveal 500ms ease both;
}

.image-card:hover .funny-image {
  transform: scale(1.045) rotate(0.8deg);
}

.image-frame {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--panel-strong);
}

.funny-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 360ms ease;
}

.card-body {
  padding: 16px;
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.25;
}

.tag {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  color: #061015;
  background: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 800;
}

.caption {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

@keyframes floaty {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -14px;
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 32px 0;
  }

  .hero-preview {
    min-height: 330px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  h1 {
    font-size: clamp(3.3rem, 18vw, 5.5rem);
  }

  .hero-preview {
    min-height: 270px;
  }

  .toolbar {
    position: static;
  }

  .filter-button,
  .shuffle-button {
    flex: 1 1 auto;
  }

  .gallery {
    grid-template-columns: 1fr;
  }
}
