:root {
  color-scheme: light;
  --paper: #f5f5f1;
  --white: #fff;
  --ink: #1a1c19;
  --muted: #65685f;
  --surface: #e9ebe3;
  --lime: #d5fa45;
  font-family: "Helvetica Neue", Arial, "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body, h1, h2, h3, p, figure { margin: 0; }
button, input, textarea, select { font: inherit; }
button, summary, select { cursor: pointer; }
button { border: 0; color: inherit; background: transparent; }
a { color: inherit; text-decoration: none; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #687b22; outline-offset: 4px; }
button:disabled { opacity: .45; cursor: wait; }
[hidden] { display: none !important; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; padding: 13px 20px; border-radius: 5px; font-weight: 700; }
.primary { background: var(--ink); color: var(--lime); }
.primary:hover { background: #38402c; }
.secondary { background: var(--surface); }
.secondary:hover { background: #dce1ce; }
.wide { width: 100%; }
.quiet { padding: 7px 0; font-weight: 600; }
.quiet:hover { text-decoration: underline; }
.icon-button { font-size: 28px; line-height: 1; width: 36px; height: 36px; background: var(--surface); border-radius: 50%; }
.page { max-width: 1680px; padding-inline: clamp(16px, 3.2vw, 56px); margin-inline: auto; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 16px clamp(16px, 3.2vw, 56px); gap: 20px; background: var(--paper); }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 1.35rem; font-weight: 800; letter-spacing: -.055em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; background: var(--lime); width: 35px; height: 35px; font-size: 24px; }
nav { display: flex; align-items: center; gap: 6px; }
.nav-tab { padding: 10px 14px; color: var(--muted); font-weight: 600; border-radius: 5px; white-space: nowrap; }
.nav-tab.active { background: var(--surface); color: var(--ink); }
#mine-count:not(:empty) { font-size: .8rem; margin-left: 5px; }
.intro { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .65fr); align-items: center; gap: 36px; padding-block: 40px 50px; }
h1 { font-size: clamp(3.2rem, 5.8vw, 6.8rem); line-height: 1.01; letter-spacing: -.065em; font-weight: 800; }
h1 span { white-space: nowrap; }
.intro p { font-size: 1.15rem; line-height: 1.5; margin-top: 22px; }
.intro p span { color: var(--muted); font-size: 1rem; }
.intro-actions { display: flex; gap: 24px; align-items: center; margin-top: 22px; }
.origin { width: 100%; max-width: 330px; justify-self: end; background: #ece1c3; transform: rotate(2deg); }
.origin img { display: block; width: 100%; height: auto; }
.origin > div { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; font-size: .8rem; gap: 8px; }
.origin button { font-weight: 700; }
.feed-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; padding-block: 30px 20px; }
h2 { font-size: clamp(1.75rem, 3vw, 2.6rem); letter-spacing: -.055em; line-height: 1.08; }
.feed-heading p, .examples-heading p { color: var(--muted); margin-top: 8px; font-size: .95rem; }
.feed-tools { display: flex; gap: 8px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; background: var(--white); padding: 10px 12px; border-radius: 5px; }
.search input { border: 0; background: transparent; width: 220px; min-width: 0; outline-offset: 0; }
select { background: var(--surface); border: 0; padding: 11px; border-radius: 5px; }
.filters { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 22px; }
.filter { padding: 8px 14px; border-radius: 30px; background: var(--surface); font-size: .9rem; }
.filter.active { background: var(--ink); color: var(--white); }
.feed { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 18px; }
.meme { min-width: 0; }
.meme-art { display: block; width: 100%; padding: 0; background: var(--surface); overflow: hidden; border-radius: 6px; }
.meme-art img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; transition: transform 180ms; }
.meme-art:hover img { transform: scale(1.025); }
.meme-meta { display: flex; align-items: start; gap: 8px; margin-top: 12px; }
.avatar { display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; background: #dfe4ce; border-radius: 50%; font-size: .85rem; font-weight: 700; }
.meme-text { min-width: 0; flex: 1; }
.meme-text > button { text-align: left; display: block; padding: 0; font-weight: 650; font-size: .95rem; line-height: 1.35; overflow-wrap: anywhere; }
.meme-text > p { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.meme-actions { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.meme-actions button { padding: 0; font-size: .85rem; color: var(--muted); }
.meme-actions .remix-action { font-weight: 700; color: var(--ink); }
.meme-actions [aria-pressed="true"] { color: #b32343; }
.examples-heading { margin-block: 38px 20px; }
.examples-heading h3 { font-size: 1.2rem; letter-spacing: -.025em; }
.status { color: var(--muted); font-size: .9rem; line-height: 1.5; }
.status:not(:empty) { margin-block: 10px; }
.empty { text-align: center; padding: 80px 16px; background: var(--surface); border-radius: 6px; }
.empty h3 { font-size: 1.8rem; letter-spacing: -.05em; }
.empty p { color: var(--muted); margin-block: 12px 24px; }
dialog { border: 0; padding: 0; color: var(--ink); background: var(--paper); width: min(1160px, calc(100vw - 48px)); max-height: calc(100dvh - 48px); border-radius: 12px; }
dialog::backdrop { background: #10130fd9; }
.dialog-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; gap: 12px; position: sticky; top: 0; background: var(--paper); z-index: 2; }
.composer-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(330px, 1fr); }
.canvas-area { background: #252723; padding: 24px; display: flex; flex-direction: column; justify-content: center; gap: 18px; min-width: 0; color: #d9dace; }
.canvas-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .85rem; }
.canvas-top .quiet { color: inherit; }
canvas { display: block; width: 100%; height: auto; }
#draft-state { font-size: .8rem; color: #aeb3a5; }
#editor { padding: 28px; }
#editor h2 { margin-bottom: 26px; }
#editor label { display: block; font-weight: 650; font-size: .9rem; margin-bottom: 8px; }
#editor label span { font-weight: 400; color: var(--muted); }
#editor textarea, #editor input[type="text"], #editor input[type="url"], #copy-fallback {
  width: 100%; display: block; border: 0; background: #e7e9e1; padding: 12px; color: inherit; border-radius: 5px;
}
#caption { resize: vertical; font-size: 1.35rem; line-height: 1.25; }
.sentence-ending { display: flex; align-items: center; gap: 10px; margin-block: 8px 22px; }
.sentence-ending > span:nth-child(2) { font-size: 1.6rem; font-weight: 800; }
#character-count { margin-left: auto; font-size: .75rem; color: var(--muted); }
.template-label { display: flex; align-items: center; justify-content: space-between; font-size: .85rem; margin-bottom: 8px; }
.template-label > span { font-weight: 650; }
.template-picker { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.template-option { padding: 3px; background: #e0e3d8; border-radius: 5px; min-width: 0; }
.template-option[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.template-option img { width: 100%; display: block; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 3px; }
.template-option span { display: block; padding: 5px 2px; font-size: .72rem; }
.photo-control { margin-top: 18px; background: #e7e9e1; border-radius: 5px; padding: 12px; }
#editor .upload { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0; cursor: pointer; flex-wrap: wrap; }
.upload span { font-size: .8rem; }
#remove { font-size: .8rem; padding-bottom: 0; }
details { margin-top: 14px; font-size: .85rem; }
summary { padding-block: 8px; color: var(--muted); }
details label { margin-top: 12px; }
#save-creation { margin-top: 22px; }
.save-note { font-size: .75rem; color: var(--muted); line-height: 1.4; margin-top: 10px; text-align: center; }
.detail-layout { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(300px,1fr); }
.detail-art { background: #252723; display: flex; flex-direction: column; justify-content: center; padding: 24px; gap: 14px; min-width: 0; }
.detail-art img { width: 100%; height: auto; display: block; }
.detail-art p { color: #b9bdae; font-size: .85rem; }
.detail-info { padding: 32px; }
.detail-info h2 { font-size: 2rem; overflow-wrap: anywhere; }
#detail-state { color: var(--muted); font-size: .9rem; line-height: 1.5; margin-block: 14px 28px; }
.detail-info .wide { margin-bottom: 10px; }
.download-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.project-link { display: block; margin-top: 20px; text-decoration: underline; }
#copy-fallback { resize: vertical; font-size: .9rem; }
.footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 80px; padding-block: 30px; }
.footer > span { color: var(--muted); font-size: .85rem; }
#toast { position: fixed; z-index: 30; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 12px 20px; background: var(--ink); color: var(--white); border-radius: 5px; max-width: calc(100vw - 32px); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
body.modal-open { overflow: hidden; }
@media (max-width: 1100px) {
  .feed { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .search input { width: 160px; }
  .intro { grid-template-columns: minmax(0,1.5fr) minmax(220px,.65fr); }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 12px; padding-block: 12px; }
  .topbar .brand { font-size: 1.15rem; }
  .topbar > .primary { margin-left: auto; font-size: .8rem; padding: 10px 12px; }
  nav { order: 3; width: 100%; justify-content: center; }
  .nav-tab { flex: 1; padding: 9px 8px; font-size: .85rem; }
  .intro { grid-template-columns: minmax(0,1fr) 140px; gap: 16px; padding-block: 24px 28px; }
  h1 { font-size: clamp(2.15rem,5.8vw,3.3rem); }
  .intro p { font-size: .95rem; margin-top: 16px; }
  .intro p span { font-size: .8rem; }
  .intro-actions { flex-wrap: wrap; gap: 9px; margin-top: 16px; }
  .intro-actions .primary { padding: 11px 12px; font-size: .85rem; }
  .intro-actions .quiet { font-size: .85rem; }
  .origin > div { padding: 7px; font-size: .7rem; }
  .origin > div > span { display: none; }
  .feed-heading { flex-wrap: wrap; padding-top: 20px; }
  .feed-tools { width: 100%; }
  .search { flex: 1; min-width: 0; }
  .search input { width: 100%; font-size: .85rem; }
  #sort { font-size: .85rem; }
  .feed { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px 12px; }
  .meme-meta { gap: 7px; }
  .avatar { width: 24px; height: 24px; font-size: .7rem; }
  .meme-text > button { font-size: .85rem; }
  .meme-text > p { font-size: .7rem; }
  .meme-actions { flex-wrap: wrap; gap: 12px; }
  dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 8px; }
  .dialog-top { padding: 12px 16px; }
  .dialog-top .brand { font-size: 1.1rem; }
  .composer-layout, .detail-layout { grid-template-columns: 1fr; }
  .canvas-area { padding: 14px; gap: 10px; }
  #preview { max-height: 245px; object-fit: contain; }
  #editor { padding: 20px; }
  #editor h2 { display: none; }
  .detail-art { padding: 16px; }
  .detail-info { padding: 22px; }
  .footer { flex-wrap: wrap; }
  .footer > span { order: 3; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
.draft-banner { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 16px; background: #e7edce; padding: 16px 20px; border-radius: 6px; font-size: .9rem; overflow-wrap: anywhere; }

.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 24px; background: var(--paper); position: sticky; bottom: 0; z-index: 3; }
.composer-bottom .save-note { margin: 0; text-align: left; }
.composer-bottom #save-creation { margin: 0; flex-shrink: 0; }
.composer-bottom .status:not(:empty) { margin-top: 0; }
@media (max-width: 760px) {
  .composer-bottom { padding: 12px 16px; }
  .composer-bottom .save-note { max-width: 22ch; font-size: .7rem; }
  .composer-bottom #save-creation { font-size: .85rem; padding: 12px; }
}
@media (max-width: 760px) {
  .intro > div:first-child { display: contents; }
  .intro h1 { grid-column: 1 / -1; font-size: clamp(2rem, 7.4vw, 3.3rem); }
  .intro p { grid-column: 1; grid-row: 2; margin-top: 0; }
  .intro-actions { grid-column: 1; grid-row: 3; margin-top: 0; }
  .origin { grid-column: 2; grid-row: 2 / 4; align-self: center; }
}
.record-filters { margin-block: 8px 20px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.record-filters .filter { border-radius: 4px; }
.editing-note { font-size: .8rem; line-height: 1.5; color: #68685f; padding: 10px 12px; background: #edf0df; }
.owner-actions { display: flex; gap: 8px; margin-block: 18px 10px; }
.owner-actions > button:first-child { flex: 1; }
.result-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
#result-progress { color: #696960; font-size: .75rem; font-variant-numeric: tabular-nums; }
#detail-image { background: #e9e9df; }
.danger { color: #a52b32; margin-top: 24px; }
#toast button { color: #d5fa45; text-decoration: underline; }
#save-version { flex-shrink: 0; }
button:focus-visible, a:focus-visible { outline: 3px solid #7c9b15; outline-offset: 4px; }
@media (max-width: 760px) {
  .composer-bottom { flex-wrap: wrap; gap: 8px; }
  .composer-bottom > div { flex: 1; }
  #save-version { font-size: .75rem; padding: 10px; }
  .composer-bottom:has(#save-version:not([hidden])) > div { flex-basis: 100%; }
  .composer-bottom:has(#save-version:not([hidden])) .save-note { max-width: none; }
  .draft-banner { flex-wrap: wrap; gap: 8px; }
  .draft-banner > span { flex-basis: 100%; }
}
.detail-art #result-play { color: #e8edde; }
.detail-art #result-progress { color: #b9bdae; }
.detail-art #detail-credit { margin-top: 0; }
.remix-context { padding: 28px 32px 32px; border-top: 1px solid #daddd0; }
.context-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.context-heading h3 { font-size: 1.5rem; letter-spacing: -.04em; }
#remix-count { color: var(--muted); font-size: .8rem; }
.remix-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-top: 16px; }
.context-card { display: flex; flex-direction: column; gap: 7px; text-align: left; min-width: 0; padding: 0 0 10px; }
.context-card img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 4px; }
.context-card strong { font-size: .9rem; line-height: 1.3; overflow-wrap: anywhere; }
.context-card span { font-size: .75rem; color: var(--muted); }
.context-card:hover img { outline: 2px solid #8b9d60; outline-offset: 3px; }
.context-create { background: #e7edce; border: 1px dashed #9ba87c; padding: 24px; border-radius: 4px; font-weight: 700; min-height: 100px; }
#remix-origin:not(:empty) { display: grid; grid-template-columns: 140px minmax(0,300px); gap: 18px; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid #daddd0; }
#remix-origin > p { font-size: .8rem; color: var(--muted); line-height: 1.5; }
#unpublish { margin-top: 20px; }
@media (max-width: 760px) {
  .remix-context { padding: 22px; }
  .remix-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  #remix-origin:not(:empty) { grid-template-columns: 1fr; gap: 10px; }
  #remix-origin .context-card { max-width: 240px; }
  .context-heading { align-items: start; }
}
