* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0b0b0c;
  color: #f2f2f2;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  text-align: center;
  padding: 1.25rem 1rem 0.5rem;
}

.topbar h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: #9a9a9a;
}

.subpath-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.65rem;
  padding: 0.32rem 0.7rem;
  border: 1px solid #2f2f33;
  border-radius: 999px;
  color: #f2f2f2;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(242, 242, 242, 0.04);
}

.subpath-link:hover {
  background: rgba(242, 242, 242, 0.08);
}

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 1rem;
  min-height: 0;
}

#meme-image {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.25s ease;
}

#meme-image.loaded {
  opacity: 1;
}

.loading,
.error {
  position: absolute;
  color: #9a9a9a;
  font-size: 0.95rem;
}

.error button,
.credit button {
  background: #f2f2f2;
  color: #0b0b0c;
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}

.error button:hover,
.credit button:hover {
  background: #ffffff;
}

.credit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem 1.5rem;
  font-size: 0.85rem;
  color: #9a9a9a;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

#meme-caption {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .credit {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
}
