@font-face { font-family: Fredoka; src: url(/fonts/Fredoka-latin.woff2) format("woff2"); font-weight: 300 700; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Fredoka; src: url(/fonts/Fredoka-latin-ext.woff2) format("woff2"); font-weight: 300 700; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF; }
/* Meme captions only (drawn on canvas), never the interface. */
@font-face { font-family: Anton; src: url(/fonts/Anton-Regular.ttf) format("truetype"); font-display: swap; }
/* The memeloaf.com watermark on free memes (canvas). */
@font-face { font-family: Inter; src: url(/fonts/Inter-latin.woff2) format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --bg: #fbf4ea; --card: #fff; --ink: #1c2547; --muted: #5d6583; --line: #eadccb;
  --blue: #2a3a86; --blue-ink: #fff; --coral: #ff6f5e; --coral-soft: #ffe2dc; --coral-ink: #7a2318; --err: #b3261e;
  --shadow: 0 1px 2px rgb(28 37 71 / .06), 0 10px 30px rgb(28 37 71 / .09);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1430; --card: #19224a; --ink: #f6eee3; --muted: #a7afcb; --line: #2a3460;
    --blue: #8fa1ff; --blue-ink: #0e1430; --coral: #ff8d7f; --coral-soft: #3c2340; --coral-ink: #ffd5ce; --err: #ff8a80;
    --shadow: 0 10px 30px rgb(0 0 0 / .35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1430; --card: #19224a; --ink: #f6eee3; --muted: #a7afcb; --line: #2a3460;
  --blue: #8fa1ff; --blue-ink: #0e1430; --coral: #ff8d7f; --coral-soft: #3c2340; --coral-ink: #ffd5ce; --err: #ff8a80;
  --shadow: 0 10px 30px rgb(0 0 0 / .35); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 ui-rounded, "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: 3px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3, .logo { font-family: Fredoka, ui-rounded, system-ui, sans-serif; font-weight: 600; letter-spacing: -.01em; line-height: 1.1; }
h1 { font-size: clamp(40px, 7vw, 64px); margin: 0 0 10px; }
h2 { font-size: clamp(28px, 4vw, 36px); margin: 0 0 16px; }
h3 { font-size: 20px; margin: 0 0 6px; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
[hidden] { display: none !important; }

/* header and footer */
.nav { display: flex; align-items: center; gap: 16px; padding: 14px 0; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-size: 24px; text-decoration: none; }
.logo img { width: 34px; height: 34px; flex: none; }
.nav .links { display: flex; gap: 16px; margin-left: auto; align-items: center; }
.nav .links > a:not(.btn) { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 15px; }
.nav .links > a:not(.btn):hover { color: var(--ink); }
@media (max-width: 640px) { .nav .links > .hide-sm { display: none; } }
footer { border-top: 1px solid var(--line); margin-top: 72px; padding: 28px 0 40px; font-size: 14px; color: var(--muted); }
footer .cols { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; }
footer a { color: var(--muted); }
footer .spacer { flex: 1; }

/* buttons and small bits */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: var(--blue); color: var(--blue-ink); border-color: transparent; }
.btn.small { font-size: 14px; padding: 6px 14px; }
.btn.quiet { background: transparent; }
.btn.quiet:hover { transform: none; box-shadow: none; border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } html { scroll-behavior: auto; } }
.pill { display: inline-flex; align-items: center; font-weight: 700; font-size: 13px; background: var(--coral-soft); color: var(--coral-ink); border-radius: 999px; padding: 3px 12px; }
.status { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.status.err { color: var(--err); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row .spacer { flex: 1; }

/* generator: the homepage */
.gen { max-width: 820px; margin: 0 auto; padding: 40px 0 0; }
.gen > h1, .gen > .lead { text-align: center; }
.gen .lead { font-size: 18px; color: var(--muted); max-width: 34em; margin: 0 auto 24px; }
.box { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 14px; box-shadow: var(--shadow); }
.box:focus-within { border-color: var(--blue); }
.box textarea { width: 100%; min-height: 84px; resize: vertical; border: 0; outline: none; background: transparent; color: var(--ink); font: inherit; font-size: 18px; padding: 4px 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; justify-content: center; }
.chip { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.chip:hover { border-color: var(--blue); }
.reply { margin-top: 28px; }
.reply .said { font-family: Fredoka, ui-rounded, sans-serif; font-size: 20px; margin: 0 0 10px; }
.memes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; align-items: start; }
.examples .memes { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .examples .memes { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .memes { grid-template-columns: 1fr; } }
.meme { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.meme canvas { width: 100%; height: auto; display: block; }
/* Caption boxes laid over the canvas: drag to move, corner grip to resize. Outlines show on hover, or always on touch screens. */
.stage { position: relative; }
.stage .hit { position: absolute; border: 1.5px dashed transparent; border-radius: 4px; cursor: move; touch-action: none; }
.stage:hover .hit, .stage .hit.on { border-color: rgba(255,255,255,.85); box-shadow: 0 0 0 1px rgba(0,0,0,.45); }
.stage .grip { position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid #000; cursor: nwse-resize; opacity: 0; }
.stage:hover .grip, .stage .hit.on .grip { opacity: 1; }
@media (hover: none) {
  .stage .hit { border-color: rgba(255,255,255,.7); box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
  .stage .grip { width: 22px; height: 22px; opacity: 1; }
}
.meme .body { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.meme input { width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; }
/* One row per caption: its text, color, font and a remove button. */
.meme .row { display: flex; gap: 6px; align-items: center; }
.meme .row input[type=text] { flex: 1; min-width: 0; }
.meme input[type=color] { flex: none; width: 36px; height: 34px; padding: 3px; cursor: pointer; }
.meme input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.meme input[type=color]::-webkit-color-swatch { border: 1px solid var(--line); border-radius: 6px; }
.meme input[type=color]::-moz-color-swatch { border: 1px solid var(--line); border-radius: 6px; }
.meme select { flex: none; font: inherit; font-size: 13px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 4px; }
.meme .x { flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.meme .x:hover { background: var(--coral-soft); color: var(--coral-ink); }
.meme .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.examples { margin-top: 40px; }
.examples h2 { font-size: 22px; text-align: center; }
.examples figure { margin: 0; }
.examples img { border-radius: 14px; border: 1px solid var(--line); }
.examples figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }

/* sections below the generator */
section.block { padding: 72px 0 0; }
.narrow { max-width: 760px; margin: 0 auto; }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 760px) { .cols3 { grid-template-columns: 1fr; } }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: stretch; }
@media (max-width: 860px) { .plans { grid-template-columns: 1fr; } }
.plan { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 24px; display: flex; flex-direction: column; gap: 2px; }
.plan.pop { border: 2px solid var(--coral); box-shadow: var(--shadow); }
.plan .pill { position: absolute; top: -13px; left: 22px; background: var(--coral); color: #fff; }
.plan .price { font-family: Fredoka, ui-rounded, sans-serif; font-weight: 600; font-size: 44px; line-height: 1.1; }
.plan .price span { font-size: 18px; color: var(--muted); font-weight: 500; }
.plan ul { padding-left: 18px; margin: 12px 0 20px; color: var(--muted); font-size: 15px; }
.plan .btn { margin-top: auto; }
details { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; margin-bottom: 10px; }
details summary { cursor: pointer; font-weight: 700; }
details p { margin: 10px 0 0; color: var(--muted); }

/* legal pages */
.prose { max-width: 760px; padding: 24px 0; }
.prose h1 { font-size: clamp(34px, 5vw, 48px); }
.prose h2 { font-size: 24px; margin-top: 36px; }
.prose .updated { color: var(--muted); font-size: 14px; }

/* dialogs */
input[type="search"] { width: 100%; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 14px; max-height: 60vh; overflow: auto; padding: 2px; }
.thumb { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); cursor: pointer; text-align: left; padding: 0; font: inherit; color: inherit; }
.thumb img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.thumb span { display: block; padding: 6px 8px; font-size: 13px; font-weight: 600; }
.thumb:hover { border-color: var(--blue); }
.products { display: grid; gap: 10px; margin: 14px 0; }
.product { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; cursor: pointer; }
.product:hover { border-color: var(--blue); }
.product b { font-family: Fredoka, ui-rounded, sans-serif; font-weight: 600; font-size: 18px; margin-left: auto; }
dialog { border: 1px solid var(--line); border-radius: 24px; background: var(--bg); color: var(--ink); padding: 22px; width: min(720px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(14 20 48 / .5); }
