@font-face { font-family: "Anton"; src: url(/fonts/anton.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Nunito"; src: url(/fonts/nunito-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(/fonts/nunito-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(/fonts/nunito-800.woff2) format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(/fonts/nunito-900.woff2) format("woff2"); font-weight: 900; font-display: swap; }

:root {
  --bg: #F6F3FF; --card: #fff; --ink: #1B1530; --muted: #6B6485; --line: #E7E1F5;
  --pri: #7C3AED; --pri-d: #5B21B6; --pri-l: #EDE4FF; --pink: #F72585; --yel: #FFD60A; --danger: #DC2626; --ok: #16A34A;
  --r: 18px; --shadow: 0 1px 2px rgba(40,20,90,.06), 0 6px 20px rgba(40,20,90,.06);
  --top: 60px; --bottom: 64px; --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 500 16px/1.45 "Nunito", system-ui, sans-serif; color: var(--ink); background: var(--bg); padding-bottom: calc(var(--bottom) + var(--safe-b)); }
a { color: var(--pri); text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; font-weight: 900; }
p { margin: 0 0 .6em; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .center { text-align: center; } .grow { flex: 1; }
.row { display: flex; align-items: center; } .gap { gap: 8px; } .wrap { flex-wrap: wrap; } .end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 99; background: #fff; padding: 8px; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- navegação ---------- */
.topnav { position: sticky; top: 0; z-index: 20; height: var(--top); display: flex; align-items: center; gap: 12px; padding: 0 16px; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 900; font-size: 1.35rem; letter-spacing: -.02em; }
.logo-mark { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--pri), var(--pink)); font-family: Anton, sans-serif; font-size: 1.2rem; transform: rotate(-6deg); }
.top-search { display: none; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 0 12px; height: 40px; color: var(--muted); min-width: 0; }
.top-search input { border: 0; background: none; outline: none; width: 100%; color: var(--ink); }
.me-link { display: flex; }
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; height: calc(var(--bottom) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex; background: #fff; border-top: 1px solid var(--line); }
.bn { flex: 1; white-space: nowrap; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .72rem; font-weight: 800; }
.bn.on { color: var(--pri); }
.bn.create { color: var(--ink); }
.create-dot { width: 44px; height: 24px; margin-top: -2px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--pri), var(--pink)); box-shadow: 0 4px 12px rgba(124,58,237,.35); }
.hide-mobile { display: none !important; }
@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .bottomnav { display: none; }
  .top-search { display: flex; width: 340px; }
  .hide-mobile { display: inline-flex !important; }
}

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font-weight: 800; cursor: pointer; text-align: center; transition: transform .08s, background .15s; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--pri); border-color: var(--pri); color: #fff; box-shadow: 0 4px 14px rgba(124,58,237,.28); }
.btn.primary:hover { background: var(--pri-d); }
.btn.danger { background: #fff; border-color: #FCA5A5; color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .9rem; border-radius: 12px; }
.btn.lg { min-height: 52px; font-size: 1.05rem; padding: 0 22px; }
.btn.block { width: 100%; }
.icon-btn { width: 42px; height: 42px; display: inline-grid; place-items: center; border: 0; background: transparent; border-radius: 12px; color: var(--ink); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--pri-l); }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.icon-btn.sm { width: 36px; height: 36px; border: 1.5px solid var(--line); background: #fff; }
.link { font-weight: 800; }

/* ---------- layout ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 16px; }
.page-title { font-size: 1.6rem; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line); }
.hero { padding: 18px 4px 8px; }
.hero h1 { font-size: clamp(1.9rem, 6vw, 3rem); letter-spacing: -.02em; }
.hero .hl { background: linear-gradient(90deg, var(--pri), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 1.05rem; max-width: 520px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 10px; gap: 12px; }
.section-head h2 { margin: 0; font-size: 1.2rem; }
h2.sub { font-size: 1.1rem; margin: 18px 0 10px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; flex-wrap: nowrap; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); color: var(--ink); font-weight: 800; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 12px 0 16px; }
.tab { padding: 10px 14px; font-weight: 900; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab.on { color: var(--ink); border-color: var(--pri); }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; gap: 4px; border: 1px solid var(--line); }
.seg button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 800; cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* ---------- modelos ---------- */
.tpl-row { display: grid; grid-auto-flow: column; grid-auto-columns: 42%; gap: 10px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.tpl-row .tpl-card { scroll-snap-align: start; }
@media (min-width: 760px) { .tpl-row { grid-auto-columns: 180px; } }
.tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 640px) { .tpl-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .tpl-grid { grid-template-columns: repeat(4, 1fr); } }
.tpl-card { position: relative; display: flex; flex-direction: column; background: #fff; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); transition: transform .12s; }
.tpl-card:hover { transform: translateY(-2px); }
.tpl-card img { aspect-ratio: 1; object-fit: cover; width: 100%; background: var(--bg); }
.tpl-title { padding: 8px 10px 10px; font-weight: 800; font-size: .88rem; line-height: 1.2; }
.demo-badge { position: absolute; top: 8px; left: 8px; background: rgba(27,21,48,.75); color: #fff; font-size: .68rem; font-weight: 900; padding: 2px 7px; border-radius: 6px; text-transform: uppercase; letter-spacing: .04em; }
.upload-card { border: 2px dashed #C4B5FD; background: var(--pri-l); box-shadow: none; }
.upload-inner { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--pri-d); padding: 10px; text-align: center; }
.upload-inner small { color: var(--muted); }

/* ---------- feed ---------- */
.feed-grid { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 760px) { .feed-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .feed-grid { grid-template-columns: repeat(3, 1fr); } }
.post-card { overflow: hidden; }
.author-line { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 12px; }
.author { display: flex; align-items: center; gap: 10px; color: var(--ink); min-width: 0; flex: 1; }
.author-names { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.author-names b, .author-names small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.author-names small { color: var(--muted); }
.avatar { flex: none; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 900; }
.meme-img { width: 100%; height: auto; background: #eee; }
.meme-link { display: block; }
.caption { padding: 10px 14px 0; margin: 0; }
.card-actions { display: flex; align-items: center; gap: 2px; padding: 8px 10px 12px; }
.act { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 8px; border-radius: 10px; color: var(--ink); font-weight: 800; cursor: pointer; min-height: 40px; }
.act:hover { background: var(--bg); }
.act.liked { color: var(--pink); }
.origin-chip { display: inline-flex; align-items: center; gap: 4px; margin: -4px 0 8px 12px; font-size: .8rem; font-weight: 800; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 0; }
.tags a { font-weight: 800; font-size: .9rem; }

.thumb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 760px) { .thumb-grid { grid-template-columns: repeat(5, 1fr); } }
.thumb { position: relative; border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.thumb img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.thumb-by { position: absolute; left: 4px; bottom: 4px; right: 4px; font-size: .7rem; font-weight: 800; color: #fff; background: rgba(0,0,0,.55); padding: 1px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { text-align: center; padding: 40px 16px; }
.empty-emoji { font-size: 2.6rem; }
.loading { display: flex; gap: 6px; justify-content: center; padding: 40px; }
.loading span { width: 10px; height: 10px; border-radius: 50%; background: var(--pri); animation: b 1s infinite ease-in-out; }
.loading span:nth-child(2) { animation-delay: .15s; } .loading span:nth-child(3) { animation-delay: .3s; }
@keyframes b { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* ---------- página do meme ---------- */
.post-layout { display: grid; gap: 16px; }
@media (min-width: 900px) { .post-layout { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } }
.post-main { overflow: hidden; }
.post-main > .page-title { padding: 14px 14px 4px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 14px; }
.cta-row .btn { flex: 1 1 200px; }
.origin { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.origin h3 { margin: 0; }
.ref { display: flex; align-items: center; gap: 10px; color: var(--ink); padding: 6px; border-radius: 12px; background: var(--bg); }
.ref img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; flex: none; }
.ref.unavailable { color: var(--muted); gap: 6px; padding: 10px; }
.lineage { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lineage img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.lin-x { width: 44px; height: 44px; display: grid; place-items: center; background: var(--line); border-radius: 8px; }
.versions { margin-top: 24px; }
.banner { display: flex; gap: 12px; align-items: center; background: var(--pri-l); border: 1px solid #DDD0FF; border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; }
.banner.small { font-size: .9rem; font-weight: 700; color: var(--pri-d); }
.banner.warn { background: #FFF7E0; border-color: #FDE68A; color: #92400E; font-weight: 700; }
.banner-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex: none; }

/* ---------- perfil ---------- */
.profile-head { display: flex; gap: 16px; align-items: flex-start; padding: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.profile-head h1 { margin: 0; font-size: 1.4rem; }
.profile-head .muted { margin: 0 0 6px; }
.stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: .92rem; color: var(--muted); }
.stats b { color: var(--ink); }

/* ---------- busca ---------- */
.search-bar { display: flex; align-items: center; gap: 8px; background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 6px 6px 6px 14px; margin-bottom: 8px; color: var(--muted); }
.search-bar input { flex: 1; border: 0; outline: none; background: none; min-width: 0; font-size: 1rem; color: var(--ink); }

/* ---------- formulários e folhas ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: .92rem; }
.field input:not([type=radio]):not([type=checkbox]), .field textarea, .stack > textarea, .sheet textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; background: #fff; font-weight: 600; font-size: 1rem; outline: none; }
.field input:focus, textarea:focus { border-color: var(--pri); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--pri); flex: none; }
.radio-list { display: flex; flex-direction: column; gap: 6px; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 600; font-size: .94rem; }
.radio input { accent-color: var(--pri); margin-top: 3px; }
.radio:has(input:checked) { border-color: var(--pri); background: var(--pri-l); }
.form-error { color: var(--danger); font-weight: 700; margin: 0; min-height: 0; }
.form-error:empty { display: none; }
.rules li { margin-bottom: 8px; }

.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(20,12,40,.45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: #fff; width: 100%; max-width: 520px; max-height: 92vh; border-radius: 22px 22px 0 0; display: flex; flex-direction: column; animation: up .2s cubic-bezier(.2,.8,.3,1); padding-bottom: var(--safe-b); }
.sheet.wide { max-width: 720px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 4px 18px; }
.sheet-head h2 { margin: 0; font-size: 1.15rem; }
.sheet-body { padding: 8px 18px 20px; overflow-y: auto; }
@media (min-width: 640px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 22px; } }
.sheet-wrap.closing { opacity: 0; transition: opacity .18s; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.menu { display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 14px 6px; border: 0; background: none; border-bottom: 1px solid var(--line); font-weight: 800; cursor: pointer; text-align: left; }
.menu-item.danger { color: var(--danger); }
.result-img { width: 100%; max-height: 46vh; object-fit: contain; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.result-img.sm { max-height: 160px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; font-weight: 800; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.share-url { background: var(--bg); border-radius: 10px; padding: 10px; overflow-x: auto; font-size: .85rem; }
.success { display: flex; align-items: center; gap: 10px; color: var(--ok); font-size: 1.1rem; }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottom) + var(--safe-b) + 14px); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 800; box-shadow: var(--shadow); animation: up .2s; transition: opacity .3s; }
.toast.err { background: var(--danger); }
.toast.out { opacity: 0; }

/* ---------- editor ---------- */
body.in-editor .bottomnav { display: none; }
body.in-editor { padding-bottom: 0; }
body.in-editor .topnav { display: none; }
.editor { max-width: 1080px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.ed-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.ed-title { font-size: 1.05rem; }
.ed-main { flex: 1; display: flex; flex-direction: column; }
.ed-stage { position: sticky; top: 55px; z-index: 4; background: #ECE6FA; display: flex; justify-content: center; padding: 10px; border-bottom: 1px solid var(--line); }
.ed-canvas { display: block; max-width: 100%; max-height: 42vh; max-height: 42dvh; width: auto; height: auto; border-radius: 6px; box-shadow: 0 6px 20px rgba(40,20,90,.18); background: #fff; cursor: pointer; }
.ed-panel { padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.ed-h { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 1rem; }
.ed-h small { font-weight: 600; }
.text-field { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: end; }
.text-field label { display: flex; flex-direction: column; gap: 4px; }
.tf-label { font-size: .78rem; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.text-field textarea { width: 100%; resize: none; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 1.05rem; font-weight: 700; line-height: 1.3; outline: none; background: #fff; min-height: 46px; overflow-y: auto; }
.text-field textarea:focus { border-color: var(--pri); box-shadow: 0 0 0 3px var(--pri-l); }
.style-btn { height: 46px; min-width: 88px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 900; font-size: .82rem; cursor: pointer; }
.style-btn[data-style=outline] { color: #fff; background: #1B1530; border-color: #1B1530; text-shadow: 0 0 2px #000; }
.style-btn[data-style=box] { background: #fff; box-shadow: inset 0 0 0 2px #1B1530; }
.text-field .warn { grid-column: 1 / -1; color: #B45309; font-weight: 700; }
.slot-row { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; }
.slot-row.sel { border-color: var(--pri); }
.slot-label { font-weight: 800; font-size: .9rem; }
.ed-bottom { position: sticky; bottom: 0; z-index: 5; padding: 10px 16px calc(10px + var(--safe-b)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); }
.upload-drop { width: 100%; max-width: 420px; aspect-ratio: 1; margin: 10px auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 3px dashed #C4B5FD; border-radius: 22px; background: #fff; color: var(--pri-d); cursor: pointer; padding: 20px; text-align: center; font-size: 1.1rem; }
@media (min-width: 900px) {
  .ed-main { flex-direction: row; align-items: flex-start; gap: 0; }
  .ed-stage { flex: 1.3; position: sticky; top: 55px; min-height: calc(100dvh - 55px - 73px); align-items: center; border: 0; padding: 24px; }
  .ed-canvas { max-height: calc(100dvh - 180px); }
  .ed-panel { flex: 1; max-width: 440px; padding: 20px; }
}
.report { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.report-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }

.gate { min-height: 70vh; display: grid; place-items: center; }
.gate-card { max-width: 420px; width: 100%; padding: 24px; }
.gate-card input { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; font-size: 1rem; }
