* { box-sizing: border-box }
body { margin: 0; color: #232323; background: #faf7ef; font: 16px/1.5 system-ui,sans-serif }
main { max-width: 900px; margin: auto; padding: 48px 20px; display: grid; grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr); gap: 48px; align-items: start }
.preview { display: grid; justify-items: center; gap: 14px; position: sticky; top: 24px }
canvas { display: block; width: 100%; max-width: 100%; height: auto }
button, #dl { border: 1px solid #ccc; border-radius: 5px; padding: 9px 16px; font: inherit; color: inherit; background: white; text-decoration: none; cursor: pointer }
#save, #dl { background: #874529; border-color: #874529; color: white }
.field { display: grid; grid-template-columns: 76px minmax(0,1fr); align-items: center; gap: 8px; font-size: 14px }
input:not([type=file]) { width: 100%; min-width: 0; font: inherit; font-size: 16px; color: inherit; accent-color: #555 }
input[type=text],input[type=number] { border: 0; border-bottom: 1px solid #d6d6d6; border-radius: 0; background: white; padding: 8px 1px }
details { margin: 8px 0 16px }
summary { width: fit-content; padding: 8px 0; color: #555; font-size: 14px; cursor: pointer }
.foodsection { border-top: 1px solid #e6e6e6; padding: 8px 0 }
.row { display: grid; grid-template-columns: 1fr 44px; align-items: center; gap: 6px; min-height: 44px }
.icon { grid-column: 2; grid-row: 1; display: grid; place-items: center; height: 44px; position: relative; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; color: #555 }
.icon input { opacity: 0; position: absolute; inset: 0; width: 100%; cursor: pointer }
.icon:focus-within { outline: 2px solid }
dialog { border: 1px solid #ccc; border-radius: 8px; max-width: 94vw; max-height: 94dvh; text-align: center; padding: 16px }
dialog img { display: block; max-height: 65dvh; max-width: 100%; margin: auto }
dialog p { font-size: 14px }
dialog form { display: flex; gap: 8px; justify-content: center }
dialog::backdrop { background: #0007 }

.preview { padding: clamp(8px,2vw,20px); border-radius: 18px; background: #f2e8d7 }
.editor { min-width: 0; padding: clamp(10px,2vw,22px); background: #fffefa; border: 1px solid #e7decd; border-radius: 14px }
input[type=text],input[type=number] { background: #fffefa; border-color: #ded4c3 }
summary,.icon { color: #775640 }
@media (max-width: 650px) {
  main { grid-template-columns: minmax(0, 0.85fr) minmax(0,1.15fr); gap: 8px; padding: 12px 7px 28px }
  .preview { top: 10px; padding: 6px; gap: 9px; border-radius: 10px }
  .editor { padding: 8px; border-radius: 10px }
  .field { grid-template-columns: minmax(0,1fr); gap: 0 }
  .row { grid-template-columns: minmax(0,1fr) 34px; gap: 3px; margin: 5px 0 }
  .icon { align-self: end; height: 36px }
  input[type=text],input[type=number] { padding: 3px 0 }
  details { margin: 3px 0 6px }
  #save { font-size: 14px; padding: 8px 12px }
}
.field select { width: 100%; min-width: 0; padding: 8px 22px 8px 8px; margin: 2px 0; font: inherit; font-size:16px; color: inherit; border: 1px solid #ded4c3; border-radius: 5px; appearance:none; background: #fffefa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23775640'/%3E%3C/svg%3E") right 7px center / 12px 8px no-repeat }
.photo-note { grid-column: 1/-1; color: #765f50; font-size: 12px }
.photo-note:empty { display: none }
.photo-note a { color: inherit }
#share-file, #share-post { color: white; background: #282828; border: 0; border-radius: 5px; font: inherit; text-decoration: none; padding: 10px 18px; cursor: pointer }
#share-post:not([hidden]) { display: inline-block }
dialog form { margin-top: 12px }

#random-foods { margin: 4px 0 10px; padding: 7px 10px; color: #64452d; background: #fff7e6; border-color: #dfceb5; font-size: 14px }
.credit, .credit a { color: #775f4d; font-size: 12px }
