:root {
  --bg: #EFFAF0;
  --bg-dots: #CDEFD3;
  --card: #FFFFFF;
  --ink: #2B2140;
  --muted: #6E6488;
  --line: #2B2140;
  --green: #5ED483;
  --green-dark: #1F8A4C;
  --pink: #FF4F9A;
  --mint: #3DD6C3;
  --purple: #7B61FF;
  --orange: #FF8A3D;
  --sky: #4FB3FF;
  --shadow: 4px 4px 0 var(--line);
  --shadow-lg: 6px 6px 0 var(--line);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1F17;
    --bg-dots: #183024;
    --card: #1B3226;
    --ink: #F0FFF4;
    --muted: #A9CDB6;
    --line: #07120C;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 2px, transparent 2px);
  background-size: 26px 26px;
  line-height: 1.5;
}
a { color: inherit; }
img, video { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--green);
  border-bottom: 3px solid var(--line);
  color: #2B2140;
}
.top-in {
  max-width: 1240px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px;
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; flex-shrink: 0; }
.logo-face { font-size: 34px; display: inline-block; transition: transform .3s; }
.logo:hover .logo-face { transform: rotate(-15deg) scale(1.15); }
.logo-text {
  font-family: "Bagel Fat One", "Nunito", sans-serif;
  font-size: 32px; letter-spacing: .5px; line-height: 1;
  color: var(--pink);
  text-shadow: 2px 2px 0 #2B2140, -1px -1px 0 #2B2140, 1px -1px 0 #2B2140, -1px 1px 0 #2B2140;
}
.search { flex: 1; min-width: 0; }
.search input {
  width: 100%; padding: 10px 16px;
  font: inherit; font-weight: 700; color: #2B2140;
  background: #fff; border: 3px solid #2B2140; border-radius: 999px;
  box-shadow: 3px 3px 0 #2B2140; outline: none;
}
.search input:focus { box-shadow: 3px 3px 0 var(--pink); }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; font-weight: 900; text-decoration: none; white-space: nowrap;
  color: #2B2140; background: #fff;
  border: 3px solid #2B2140; border-radius: 999px; box-shadow: 3px 3px 0 #2B2140;
  transition: transform .1s, box-shadow .1s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 #2B2140; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #2B2140; }
.btn-pink { background: var(--pink); color: #fff; }
.btn-dice:hover { animation: wiggle .4s; }

.chips {
  display: none; gap: 8px; overflow-x: auto; padding: 0 16px 10px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chips a {
  flex-shrink: 0; padding: 5px 12px; font-weight: 800; font-size: 14px; text-decoration: none;
  background: #fff; border: 2px solid #2B2140; border-radius: 999px;
}
.chips a.on { background: var(--pink); color: #fff; }
.chips small { display: none; }

/* ---------- layout ---------- */
.wrap {
  max-width: 1240px; margin: 0 auto; padding: 22px 16px;
  display: grid; grid-template-columns: 210px minmax(0, 640px) 290px; gap: 26px; justify-content: center;
}
.side { position: sticky; top: 90px; align-self: start; }
.cats { display: flex; flex-direction: column; gap: 6px; }
.cats a {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  font-weight: 800; text-decoration: none; border: 3px solid transparent; border-radius: 14px;
  transition: background .15s, transform .15s;
}
.cats a:hover { background: var(--card); border-color: var(--line); transform: translateX(3px); }
.cats a.on { background: var(--pink); color: #fff; border-color: var(--line); box-shadow: var(--shadow); }
.cats .ce { font-size: 22px; width: 26px; text-align: center; }
.cats small { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 800; }
.cats a.on small { color: #fff; }

.box {
  background: var(--card); border: 3px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 18px;
}
.box h3 { margin: 0 0 10px; font-size: 17px; font-weight: 900; }
.box p { margin: 0; font-size: 14px; color: var(--muted); }
.box-green { background: var(--green); color: #2B2140; display: flex; gap: 10px; }
.box-mint { background: var(--mint); color: #12352F; }
.box-mint p { color: #12352F; }
.stat { flex: 1; font-size: 13px; font-weight: 800; line-height: 1.2; }
.stat b { display: block; font-family: "Bagel Fat One", sans-serif; font-weight: 400; font-size: 30px; color: #fff; text-shadow: 2px 2px 0 #2B2140, -1px -1px 0 #2B2140, 1px -1px 0 #2B2140, -1px 1px 0 #2B2140; }
.tagcloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tagcloud a, .tags a {
  font-size: 13px; font-weight: 800; text-decoration: none;
  padding: 3px 10px; border-radius: 999px;
  background: var(--bg); border: 2px solid var(--line);
  transition: background .15s, color .15s;
}
.tagcloud a:hover, .tags a:hover { background: var(--purple); color: #fff; }

/* ---------- hero ---------- */
.hero {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.hero-emoji {
  font-size: 44px; width: 70px; height: 70px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--card); border: 3px solid var(--line); border-radius: 50%; box-shadow: var(--shadow);
  animation: bob 3s ease-in-out infinite;
}
.hero h1 { margin: 0; font-family: "Bagel Fat One", sans-serif; font-weight: 400; font-size: 34px; line-height: 1.1; }
.hero p { margin: 2px 0 0; color: var(--muted); }
.hero > div { flex: 1; min-width: 180px; }
.tabs { display: flex; background: var(--card); border: 3px solid var(--line); border-radius: 999px; padding: 3px; box-shadow: var(--shadow); }
.tabs a { padding: 6px 14px; border-radius: 999px; text-decoration: none; font-weight: 900; font-size: 14px; }
.tabs a.on { background: var(--green); color: #2B2140; }

/* ---------- cards ---------- */
.feed { display: flex; flex-direction: column; gap: 26px; }
.card {
  background: var(--card); border: 3px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 14px 16px 12px;
  animation: pop .35s ease-out both;
}
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-top time { font-size: 13px; color: var(--muted); }
.pill {
  display: inline-flex; gap: 4px; padding: 3px 11px; font-size: 13px; font-weight: 900; text-decoration: none;
  border: 2px solid var(--line); border-radius: 999px; color: #2B2140;
}
.pill-memes { background: var(--green); }
.pill-funny { background: var(--orange); }
.pill-animals { background: var(--mint); }
.pill-nerdy { background: var(--sky); }
.pill-wholesome { background: #FFB3D1; }
.pill-comics { background: #C9B8FF; }
.pill-jokes { background: #FFC7A8; }
.pill-fandom { background: #FFE27A; }
.pill-history { background: #E8C9A0; }
.title { margin: 0 0 12px; font-size: 21px; font-weight: 900; line-height: 1.25; overflow-wrap: anywhere; }
.title a { text-decoration: none; }
.title a:hover { color: var(--pink); }
.media {
  display: block; margin: 0 -16px; background: #000;
  border-top: 3px solid var(--line); border-bottom: 3px solid var(--line);
  min-height: 120px;
}
.media img, .media video {
  width: 100%; height: auto; max-height: 820px; object-fit: contain;
  aspect-ratio: auto 4 / 3; /* placeholder box until the real size is known */
}
.single .media img { max-height: 90vh; }
.media.broken { display: grid; place-items: center; min-height: 160px; background: var(--bg); color: var(--muted); font-weight: 800; }
.media.broken::after { content: "🙈 this one ran away"; }
.caption { margin: 10px 0 0; padding: 8px 12px; font-size: 14px; font-style: italic; color: var(--muted); background: var(--bg); border-radius: 10px; }
.joke {
  margin: 4px 0 6px; padding: 22px 20px; text-align: center;
  background: #CFF5D6; color: #123320; border: 3px solid var(--line); border-radius: 14px;
}
.joke .setup { margin: 0; font-size: 22px; font-weight: 900; line-height: 1.3; overflow-wrap: anywhere; }
.joke .punch { margin: 14px 0 0; font-size: 20px; font-weight: 800; animation: pop .3s ease-out; overflow-wrap: anywhere; }
.reveal {
  margin-top: 14px; padding: 8px 18px; font-weight: 900; background: #fff; color: #2B2140;
  border: 3px solid #2B2140; border-radius: 999px; box-shadow: 3px 3px 0 #2B2140;
}
.reveal:hover { animation: wiggle .4s; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tags:empty { display: none; }
.card-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.card-actions button {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; font-weight: 900; font-size: 15px;
  background: var(--bg); border: 2px solid var(--line); border-radius: 999px;
  transition: transform .1s, background .15s;
}
.card-actions button:hover { transform: translateY(-2px); }
.haha.on { background: var(--green); color: #2B2140; }
.haha.on span { color: var(--pink); }
.src {
  margin-left: auto; font-size: 12px; color: var(--muted); text-decoration: none;
  max-width: 45%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.src:hover { color: var(--pink); }
.card-actions .report { padding: 6px 9px; background: transparent; border-color: transparent; opacity: .55; }
.card-actions .report:hover { opacity: 1; border-color: var(--line); }

/* ---------- share menu ---------- */
.share-wrap { position: relative; }
.share[aria-expanded="true"] { background: var(--green); color: #2B2140; }
.share-menu {
  position: absolute; left: -8px; bottom: calc(100% + 12px); z-index: 30;
  width: max-content; max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px 14px;
  background: var(--card); border: 3px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: pop .18s ease-out;
}
.share-menu[hidden] { display: none; }
.share-head { margin: 0 0 10px; font-weight: 900; font-size: 15px; }
.share-grid { display: grid; grid-template-columns: repeat(5, 58px); gap: 10px 6px; }
.sh {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 0; font-size: 11px; font-weight: 800; line-height: 1.1; text-align: center;
  text-decoration: none; background: none; border: 0; color: var(--ink);
}
.card-actions .sh { padding: 0; background: none; border: 0; font-size: 11px; }
.sh i {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 2px solid var(--line); border-radius: 50%; box-shadow: 2px 2px 0 var(--line);
  transition: transform .12s;
}
.sh:hover i { transform: translateY(-3px) rotate(-6deg); }
.sh img { width: 22px; height: 22px; }
.sh-fb i { background: #1877F2; }
.sh-wa i { background: #25D366; }
.sh-vb i { background: #7360F2; }
.sh-ms i { background: linear-gradient(135deg, #0099FF, #A033FF 60%, #FF5280); }
.sh-x i { background: #000; }
.sh-tg i { background: #26A5E4; }
.sh-rd i { background: #FF4500; }
.sh-pin i { background: #E60023; }
.sh-mail i { background: var(--purple); }
.sh-copy i { background: var(--pink); }
.sh-more i { background: var(--green-dark); }
.sh-more { display: none; }
.can-share .sh-more { display: flex; }
/* Messenger links only work where the app is installed (phones) */
@media (hover: hover) and (pointer: fine) { .sh-ms { display: none; } }
@media (max-width: 600px) {
  .share-menu {
    position: fixed; left: 12px; right: 12px; bottom: 12px; max-width: none; width: auto;
  }
  .share-grid { grid-template-columns: repeat(4, 1fr); }
}

.burst { position: fixed; pointer-events: none; font-size: 26px; z-index: 50; animation: fly .9s ease-out forwards; }

.more, .single-nav { display: flex; justify-content: center; gap: 12px; margin-top: 26px; }
.more { font-weight: 900; }
.loader { text-align: center; padding: 26px; font-weight: 800; color: var(--muted); }
.loader span { display: inline-block; font-size: 26px; animation: bob 1s ease-in-out infinite; }

.empty { text-align: center; padding: 50px 20px; background: var(--card); border: 3px dashed var(--line); border-radius: var(--radius); }
.empty .big { font-size: 70px; animation: bob 2.4s ease-in-out infinite; }
.empty h1, .empty h2 { font-family: "Bagel Fat One", sans-serif; font-weight: 400; margin: 6px 0; }
.empty p { color: var(--muted); }

.about { padding: 24px 26px; }
.about h1 { font-family: "Bagel Fat One", sans-serif; font-weight: 400; font-size: 32px; margin-top: 0; }
.about h2 { font-size: 20px; font-weight: 900; margin-top: 26px; }
.about a { color: var(--pink); }

.foot { text-align: center; padding: 20px 16px 40px; font-size: 13px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  transform: translate(-50%, 140%); opacity: 0;
  padding: 10px 18px; font-weight: 900; color: #2B2140;
  background: var(--green); border: 3px solid #2B2140; border-radius: 999px; box-shadow: 3px 3px 0 #2B2140;
  transition: transform .25s, opacity .25s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- cookie consent ---------- */
.consent {
  position: fixed; left: 50%; bottom: 18px; z-index: 70; transform: translateX(-50%);
  width: min(760px, calc(100vw - 24px));
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 16px 18px;
  background: var(--card); color: var(--ink);
  border: 3px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg);
  animation: pop .3s ease-out;
}
.consent[hidden] { display: none; }
.consent-emoji { font-size: 44px; animation: bob 2.6s ease-in-out infinite; }
.consent h2 { margin: 0 0 4px; font-size: 18px; font-weight: 900; }
.consent p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.consent a { color: var(--pink); }
.consent-actions { display: flex; flex-direction: column; gap: 8px; }
.consent-actions .btn { justify-content: center; }
.consent-yes { background: var(--green); }
@media (max-width: 640px) {
  .consent { grid-template-columns: auto 1fr; bottom: 10px; }
  .consent-actions { grid-column: 1 / -1; flex-direction: row; }
  .consent-actions .btn { flex: 1; }
  .consent-emoji { font-size: 34px; }
}

/* ---------- animations ---------- */
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(4deg); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fly { to { transform: translate(var(--dx), -110px) rotate(var(--rot)) scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .wrap { grid-template-columns: 200px minmax(0, 640px); }
  .side-right { display: none; }
}
@media (max-width: 800px) {
  .wrap { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .side-left { display: none; }
  .chips { display: flex; }
  .logo-text { font-size: 26px; }
  .logo-face { font-size: 28px; }
  .btn-dice span { display: none; }
  .btn-dice { padding: 8px 12px; }
}
@media (max-width: 480px) {
  .logo-text { display: none; }
  .hero h1 { font-size: 27px; }
  .hero-emoji { width: 56px; height: 56px; font-size: 34px; }
  .card { padding: 12px 12px 10px; }
  .media { margin: 0 -12px; }
  .title { font-size: 18px; }
  .src { max-width: 100%; margin-left: 0; order: 5; flex-basis: 100%; }
}
