:root {
  --bg: #14121a;
  --bg-elev: #1e1b26;
  --bg-elev-2: #262130;
  --text: #ffffff;
  --text-dim: #b3aec0;
  --pink: #ff3e7f;
  --yellow: #ffc300;
  --purple: #7c4dff;
  --cyan: #22e5c9;
  --border: #322b3d;
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1, h2, .brand, .btn-primary, .card-caption-badge {
  font-family: 'Fredoka', 'Nunito', sans-serif;
}

.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
.container.narrow { max-width: 420px; padding-top: 64px; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 3px solid var(--purple);
  background: linear-gradient(90deg, var(--bg-elev), var(--bg-elev-2));
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  color: var(--text);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-header nav { display: flex; gap: 12px; align-items: center; flex-shrink: 0; }
.site-header nav a { color: var(--text-dim); text-decoration: none; font-weight: 600; font-size: 0.92rem; }
.site-header nav a:hover { color: var(--yellow); }

@media (min-width: 480px) {
  .site-header { padding: 18px 24px; }
  .brand { font-size: 1.4rem; }
  .site-header nav { gap: 16px; }
  .site-header nav a { font-size: 1rem; }
}

.hero {
  text-align: center;
  padding: 48px 0 24px;
  background: radial-gradient(ellipse at top, rgba(124, 77, 255, 0.25), transparent 60%);
  border-radius: var(--radius);
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 8px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--pink), var(--yellow) 60%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
}
.hero p { color: var(--text-dim); font-size: 1.05rem; font-weight: 600; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
  margin-top: 28px;
}
.card {
  display: block;
  position: relative;
  background: var(--bg-elev);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
  transform: translateY(-4px) rotate(-1deg) scale(1.02);
  border-color: var(--pink);
  box-shadow: 0 10px 30px rgba(255, 62, 127, 0.25);
}
.card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; }
.card-caption { padding: 10px 12px; font-size: 0.92rem; color: var(--text-dim); margin: 0; font-weight: 600; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 20px; margin-top: 40px; color: var(--text-dim); font-weight: 700; }
.pagination a {
  color: var(--bg);
  background: var(--yellow);
  text-decoration: none;
  padding: 8px 18px;
  border-radius: 999px;
  transition: transform 0.15s ease;
}
.pagination a:hover { transform: scale(1.06); }

.about-content { max-width: 640px; margin: 32px auto 0; font-size: 1.05rem; line-height: 1.7; }
.about-content p { margin-bottom: 20px; }
.about-content .meme-actions { justify-content: flex-start; margin-top: 8px; }

.meme-detail { max-width: 640px; margin: 0 auto; text-align: center; }
.meme-detail img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 3px solid var(--purple);
  box-shadow: 0 12px 40px rgba(124, 77, 255, 0.25);
}
.meme-caption { margin-top: 18px; font-size: 1.15rem; font-weight: 700; }
.meme-actions { display: flex; justify-content: center; gap: 14px; margin-top: 24px; flex-wrap: wrap; }
.meme-stats { color: var(--text-dim); margin-top: 14px; font-size: 0.9rem; font-weight: 600; }

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.98rem;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: linear-gradient(90deg, var(--pink), var(--purple));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 20px rgba(255, 62, 127, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 26px rgba(255, 62, 127, 0.45); }
.btn-small { padding: 5px 12px; font-size: 0.8rem; }
.btn-danger { border-color: #a33; color: #ff8080; }

.empty { text-align: center; color: var(--text-dim); padding: 64px 0; font-weight: 700; font-size: 1.1rem; }
.empty h1 { font-size: 4rem; margin-bottom: 0; }

.site-footer { text-align: center; color: var(--text-dim); padding: 28px; font-size: 0.85rem; font-weight: 600; }
.site-footer a { color: var(--yellow); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

.admin-body { background: var(--bg); color: var(--text); font-family: 'Nunito', sans-serif; }
.admin-panel { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 20px; margin-bottom: 24px; }
.admin-panel h2 { font-family: 'Fredoka', sans-serif; }
.panel-header { display: flex; justify-content: space-between; align-items: center; }

.stacked-form { display: flex; flex-direction: column; gap: 12px; max-width: 480px; }
.stacked-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--text-dim); font-weight: 600; }
.stacked-form input, .stacked-form select {
  padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-family: inherit;
}

.admin-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.admin-table th, .admin-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); font-size: 0.85rem; vertical-align: top; }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.row-form { display: flex; flex-direction: column; gap: 4px; max-width: 220px; }
.row-form input, .row-form select { padding: 4px 6px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-family: inherit; }

.badge-warning { color: var(--yellow); font-size: 0.75rem; font-weight: 700; }
.badge-success { color: var(--cyan); font-weight: 700; }
.badge-failed { color: var(--pink); font-weight: 700; }
.badge-skipped { color: var(--text-dim); }

.notice { background: #1f3a2a; border: 1px solid #2d5a3f; padding: 10px 14px; border-radius: 6px; color: #b8f2c9; font-weight: 600; }
.error { background: #3a1f1f; border: 1px solid #5a2d2d; padding: 10px 14px; border-radius: 6px; color: #f2b8b8; font-weight: 600; }

.inline-form { display: inline; }
.link-btn { background: none; border: none; color: var(--text-dim); cursor: pointer; text-decoration: underline; padding: 0; font-size: 0.9rem; font-family: inherit; }
