/* Meme generator. Same look as the rest of the site: white, one blue accent. */
.mg [hidden]{display:none!important}
.mg-hero{background:linear-gradient(180deg,#f5f9ff,#fff);border-bottom:1px solid var(--line);padding:22px 0 28px}
.mg-hero h1{font-size:clamp(28px,4.6vw,44px);margin:0 0 8px;color:var(--ink);background:none;-webkit-text-fill-color:currentColor}
.mg-lead{margin:0 0 16px;color:var(--soft);max-width:70ch;font-size:16.5px}

.mg{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(320px,1fr);gap:16px;align-items:start;background:#fff;border:1px solid var(--line);border-radius:20px;padding:14px;box-shadow:0 10px 30px rgba(17,24,39,.08)}
.mg.busy{opacity:.7;pointer-events:none}
.mg-left{min-width:0;position:sticky;top:10px}
.mg-bar{display:flex;align-items:center;gap:8px;margin-bottom:10px}.mg-bar b{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.mg-grow{flex:1}
.mg-stage{position:relative;display:flex;justify-content:center;align-items:center;background:repeating-conic-gradient(#f1f5f9 0 25%,#fff 0 50%) 0 0/22px 22px;border-radius:14px;padding:10px;min-height:220px}
.mg-stage.drop{outline:3px dashed #2563eb;outline-offset:-6px}
#mg-canvas{display:block;max-width:100%;max-height:72vh;width:auto;height:auto;touch-action:none;border-radius:4px;box-shadow:0 4px 18px rgba(17,24,39,.15);user-select:none;-webkit-user-select:none}
.mg.drawing #mg-canvas{cursor:crosshair}
.mg-help{font-size:13px;color:var(--soft);margin:8px 2px 0;text-align:center}
.mg-cropbar{position:absolute;left:8px;right:8px;bottom:8px;display:flex;flex-wrap:wrap;gap:6px;align-items:center;justify-content:center;background:rgba(17,24,39,.88);color:#fff;border-radius:12px;padding:8px}
.mg-cropbar .mg-chip{background:rgba(255,255,255,.14);color:#fff;border-color:transparent}.mg-cropbar .mg-chip[aria-pressed=true]{background:#fff;color:var(--ink)}

.mg-right{min-width:0;display:flex;flex-direction:column;gap:10px}
.mg-tabs{display:flex;gap:4px;background:#f3f4f6;border-radius:12px;padding:4px;overflow-x:auto;scrollbar-width:none}.mg-tabs::-webkit-scrollbar{display:none}
.mg-tabs button{flex:1 1 auto;border:0;background:none;border-radius:9px;padding:9px 7px;font-weight:650;font-size:14px;color:#4b5563}
.mg-tabs [aria-selected=true]{background:#fff;color:#1d4ed8;box-shadow:0 1px 3px rgba(17,24,39,.12)}
.mg-pane{display:grid;gap:10px;align-content:start;max-height:56vh;overflow:auto;padding:2px}
.mg-row{display:grid;grid-template-columns:1fr 40px 40px;gap:6px;align-items:start;border-radius:12px;padding:3px}
.mg-row.on{background:#eff6ff}
.mg-row textarea{width:100%;resize:none;border:2px solid #e5e7eb;border-radius:12px;padding:9px 12px;font-size:16px;line-height:1.35;background:#fff;min-height:44px}
.mg-row textarea:focus{outline:0;border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.15)}
.mg-ico{width:40px;height:40px;border:1px solid var(--line);background:#fff;border-radius:10px;font-weight:700;font-size:16px;color:#374151;display:grid;place-items:center;padding:0}
.mg-ico:hover:not(:disabled){border-color:#2563eb;color:#2563eb}.mg-ico:disabled{opacity:.4;cursor:default}
.mg-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:0;background:#2563eb;color:#fff;font-weight:700;border-radius:12px;padding:10px 16px;font-size:15px;text-decoration:none;white-space:nowrap}
.mg-btn:hover{background:#1d4ed8}.mg-btn.ghost{background:#fff;color:#1d4ed8;border:1px solid #bfdbfe}.mg-btn.ghost:hover{background:#eff6ff}
.mg-btn.wide{width:100%}.mg-btn.big{width:100%;padding:14px;font-size:17px;border-radius:14px;box-shadow:0 8px 20px rgba(37,99,235,.3)}
.mg-chip{border:1px solid var(--line);background:#fff;border-radius:99px;padding:7px 13px;font-size:14px;font-weight:600;color:#374151}
.mg-chip:hover{border-color:#2563eb}.mg-chip[aria-pressed=true]{background:#2563eb;border-color:#2563eb;color:#fff}.mg-chip.danger{color:#dc2626}
.mg-row2{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.mg-sub{margin:4px 0 0;font-size:13.5px;color:var(--soft)}.mg-sub b{color:var(--ink)}
.mg-f{display:grid;gap:5px;font-size:13.5px;font-weight:650;color:#374151}
.mg-f select,.mg-search{width:100%;border:1px solid #d1d5db;border-radius:10px;padding:9px 10px;font-size:15px;background:#fff}
.mg-inline{display:flex;gap:10px;align-items:center}.mg-inline input[type=range],.mg-f>input[type=range]{flex:1;accent-color:#2563eb}
.mg-tick{display:inline-flex;gap:6px;align-items:center;font-size:13.5px;font-weight:600;color:#374151}
input[type=color]{width:38px;height:32px;border:1px solid var(--line);border-radius:8px;padding:2px;background:#fff}
.mg-swatches{display:flex;flex-wrap:wrap;gap:6px}.mg-swatches button{width:30px;height:30px;border-radius:50%;border:2px solid #e5e7eb;padding:0}
.mg-swatches [aria-pressed=true]{outline:3px solid #2563eb;outline-offset:1px}
#mg-style.off{display:none}
.mg-emojis{display:grid;grid-template-columns:repeat(auto-fill,minmax(42px,1fr));gap:4px}
.mg-emojis button{font-size:26px;height:46px;border:0;background:#f9fafb;border-radius:10px;padding:0}.mg-emojis button:hover{background:#eff6ff}
.mg-tgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(98px,1fr));gap:8px}
.mg-t{border:1px solid var(--line);background:#fff;border-radius:10px;padding:4px;display:grid;gap:4px;font-size:12px;font-weight:600;text-align:center;color:var(--ink)}
.mg-t img{width:100%;height:80px;object-fit:cover;border-radius:6px;background:#f3f4f6}.mg-t:hover{border-color:#2563eb}
.mg-out{border-top:1px solid var(--line);padding-top:10px;display:grid;gap:8px}

/* template cards */
.mg-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px;flex-wrap:wrap}.mg-head h2{margin-bottom:4px}
.mg-cards{list-style:none;margin:12px 0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px}
.mg-cards a{display:grid;grid-template-rows:150px auto;background:#fff;border:1px solid var(--line);border-radius:14px;overflow:hidden;text-decoration:none;color:var(--ink);font-weight:650;font-size:14.5px;transition:box-shadow .15s,border-color .15s}
.mg-cards a:hover{border-color:#93c5fd;box-shadow:0 8px 22px rgba(17,24,39,.1)}
.mg-cards img{width:100%;height:150px;object-fit:cover;background:#f3f4f6;display:block}.mg-cards span{padding:9px 11px;line-height:1.3}
.mg-pick .mg-search{max-width:420px;margin:4px 0}.mg-catchips{margin:8px 0 6px}
.mg-libbar{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:6px}.mg-libbar .mg-search{flex:1;min-width:220px;max-width:520px;padding:12px 14px;font-size:16px}
.mg-ideas{list-style:none;padding:0;margin:10px 0;display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:8px}
.mg-ideas button{width:100%;text-align:left;border:1px solid var(--line);background:#fff;border-radius:12px;padding:11px 14px;font-size:15px;line-height:1.4;color:var(--ink)}
.mg-ideas button:hover{border-color:#2563eb;background:#eff6ff}
.mg-fig{margin:10px 0;max-width:520px}.mg-fig img{width:100%;height:auto;border-radius:12px;border:1px solid var(--line)}.mg-fig figcaption{font-size:13.5px;color:var(--soft);margin-top:6px}
.mg-dl{font-size:14.5px}

@media(max-width:899px){
 .mg{grid-template-columns:minmax(0,1fr);padding:10px;border-radius:16px;gap:10px}
 .mg-left{position:static}
 #mg-canvas{max-height:58vh}
 .mg-stage{padding:6px;min-height:160px}
 .mg-pane{max-height:none}
 .mg-out{order:-1;border-top:0;padding-top:0;border-bottom:1px solid var(--line);padding-bottom:10px}
 .mg-out .mg-btn.big{padding:12px}
 .mg-tabs button{padding:8px 7px;font-size:13.5px;flex:1 1 auto}
 .mg-help{font-size:12.5px}
 .mg-cards{grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:9px}.mg-cards a{grid-template-rows:120px auto}.mg-cards img{height:120px}
 .mg-bar .mg-btn{padding:8px 12px;font-size:14px}
}
@media(max-width:480px){.mg-tabs{display:grid;grid-template-columns:repeat(3,1fr)}}
@media(max-width:420px){.mg-bar b{display:none}.mg-cards{grid-template-columns:repeat(2,minmax(0,1fr))}}
/* inside the admin */
main .mg label{margin:0}main .mg input[type=range]{padding:0;margin:0;border:0}main .mg select{margin:0}main .mg .mg-row textarea{font-family:inherit;font-size:15px;margin:0}
main .mg{max-width:1100px;margin-bottom:16px}main .mg .mg-left{position:static}
