:root {
  --ink: #29251f;
  --muted: #746c60;
  --paper: #fffaf2;
  --card: #fffefb;
  --line: #e7dccd;
  --accent: #a9472a;
  --accent-dark: #84351f;
  --sage: #63765a;
  --shadow: 0 12px 32px rgba(62, 43, 24, .09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
html { overflow-wrap: anywhere; }
.editor-panel, .preview-panel, .recipe-heading > div { min-width: 0; }
.button.mobile-jump { display: none; }
.editor-actions { margin-bottom: 20px; }
.import-panel { margin: 0 0 24px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fffaf4; }
.import-panel h2 { margin: 0 0 8px; font-size: 1.2rem; }
.import-panel p { margin: 0 0 14px; color: var(--muted); }
.import-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.import-controls input { flex: 1 1 280px; }
.import-panel .validation { margin: 12px 0 0; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.import-file-list { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.import-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.import-file-name { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.import-file-actions { display: flex; gap: 4px; }
.import-file-actions .icon-button { width: 38px; height: 38px; min-height: 38px; }
.photo-controls { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.photo-field small { display: block; }
.preview-title { font-size: 2rem; margin: 0 0 12px; }
#preview-heading { margin-bottom: 20px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
button, .button { min-height: 44px; }
input, textarea { min-width: 0; }
[hidden] { display: none !important; }
dialog { max-width: min(560px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 20px; padding: 28px; background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(41, 37, 31, .5); }
.leave-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
button:disabled { opacity: .6; cursor: wait; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% 0, #f5e4ce 0, transparent 25rem), var(--paper); }
a { color: inherit; }
button, input, textarea { font: inherit; }
.site-header { min-height: 72px; padding: 14px clamp(18px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid rgba(231,220,205,.8); background: rgba(255,250,242,.85); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 10; }
.site-header nav { display: flex; align-items: center; gap: 18px; }
.site-header form { margin: 0; }
.brand { font-family: Georgia, serif; font-size: clamp(1.1rem, 3vw, 1.45rem); font-weight: 700; text-decoration: none; }
main { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 42px 0 80px; }
h1, h2, h3 { font-family: Georgia, serif; line-height: 1.12; }
h1 { font-size: clamp(2.2rem, 7vw, 4.5rem); margin: .2em 0; }
.eyebrow { color: var(--accent); text-transform: uppercase; font-size: .78rem; letter-spacing: .16em; font-weight: 800; }
.muted, .meta, .hint { color: var(--muted); }
.hint { font-size: .8rem; }
.button { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; padding: .75rem 1.2rem; background: var(--accent); color: white; text-decoration: none; font-weight: 750; cursor: pointer; }
.button:hover { background: var(--accent-dark); }
.button.secondary { background: #eee2d3; color: var(--ink); }
.link-button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: .4rem 0; }
.danger { color: #a42626; }
.hero { padding: clamp(20px, 5vw, 62px) 0; }
.search { display: flex; gap: 10px; width: min(720px, 100%); margin: 28px 0 12px; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; background: var(--card); color: var(--ink); }
input:focus, textarea:focus { outline: 3px solid rgba(169,71,42,.16); border-color: var(--accent); }
label { display: grid; gap: 7px; font-size: .9rem; font-weight: 700; }
.search input { border-radius: 999px; padding-left: 1.2rem; font-size: 1.05rem; }
@media (min-width: 521px) {
  .search .button { min-width: 8rem; white-space: nowrap; }
}
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 24px; }
.recipe-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; text-decoration: none; box-shadow: var(--shadow); transition: transform .2s; }
.recipe-card:hover { transform: translateY(-3px); }
.recipe-card img, .image-placeholder { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.image-placeholder { display: grid; place-items: center; background: #eee4d5; font-size: 3rem; }
.card-body { padding: 18px; }
.card-body h2 { margin: 0 0 6px; }
.card-body p:last-child { color: var(--sage); font-size: .9rem; }
.empty { grid-column: 1/-1; padding: 50px; text-align: center; border: 1px dashed var(--line); border-radius: 20px; }
.login-card { width: min(460px, 100%); margin: 8vh auto; padding: clamp(26px, 5vw, 48px); background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 2.6rem; }
.stack { display: grid; gap: 18px; }
.alert { background: #fff0ed; color: #8c2718; border: 1px solid #efc0b8; padding: 12px 15px; border-radius: 10px; }
.recipe-view { width: min(820px, 100%); margin: auto; }
.recipe-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.back { color: var(--muted); text-decoration: none; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.facts span { background: #eee4d5; padding: 7px 11px; border-radius: 999px; font-size: .88rem; }
.hero-image { width: 100%; max-height: 560px; object-fit: cover; border-radius: 22px; box-shadow: var(--shadow); }
.recipe-content { font-family: Georgia, serif; font-size: 1.08rem; line-height: 1.75; }
.recipe-content h2 { margin-top: 2.2em; padding-bottom: .35em; border-bottom: 1px solid var(--line); }
.recipe-content li { margin: .45em 0; padding-left: .3em; }
.editor-page { width: min(1400px, 100%); margin: auto; }
.editor-topbar { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.editor-topbar h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, .9fr); gap: 24px; align-items: start; }
.editor-panel, .preview-panel { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: clamp(18px, 3vw, 30px); box-shadow: var(--shadow); }
.preview-panel { position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow: auto; }
.preview-label { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 800; margin-bottom: 14px; }
.preview-image { width: 100%; max-height: 330px; object-fit: cover; border-radius: 14px; }
.three-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.validation { min-height: 1.4em; font-size: .88rem; }
.validation.valid { color: #39713a; }
.validation.invalid { color: #9d2929; }
.photo-field { margin: 24px 0; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.photo-field legend { font-weight: 700; }
.save-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); padding-top: 18px; color: var(--muted); font-size: .85rem; }
#save-status { flex: 1 1 auto; min-width: 0; }
.save-bar .button { flex: 0 0 9.5rem; width: 9.5rem; }
.delete-form { margin-top: 24px; text-align: right; }

.list-field { border: 0; margin: 0; padding: 0; min-width: 0; }
.list-field legend { font-weight: 700; margin-bottom: .45rem; }
.block-list-items { display: grid; gap: .65rem; }
.list-block {
  align-items: start;
  background: #fff;
  border: 1px solid #c9c3b7;
  border-radius: .7rem;
  display: grid;
  gap: .45rem;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: .55rem;
}
.list-block [data-list-input] { min-height: 48px; width: 100%; }
.list-block textarea[data-list-input] { overflow: hidden; resize: none; }
.icon-button {
  align-items: center;
  background: #f4f0e8;
  border: 1px solid #bdb5a7;
  border-radius: .45rem;
  display: inline-flex;
  justify-content: center;
  min-height: 44px;
  padding: .45rem .6rem;
}
.list-block-actions { display: flex; flex-wrap: wrap; gap: .3rem; }
.list-block-actions { flex-wrap: nowrap; grid-column: 2; }
.list-block-actions .icon-button { height: 44px; padding: 0; width: 44px; }
.remove-icon { color: #c52323; font-size: 1.65rem; font-weight: 800; }
.icon-button:disabled { opacity: .38; }
.add-list-item { margin-top: .65rem; }

@media (max-width: 600px) {
  .add-list-item { width: 100%; }
}

@media (max-width: 820px) {
  .site-header { position: static; }
  .site-header { flex-wrap: wrap; }
  .site-header nav { flex-wrap: wrap; }
  .button.mobile-jump { display: flex; width: 100%; min-height: 44px; margin-bottom: 20px; }
  .editor-actions .button { width: 100%; }
  .import-controls .button { width: 100%; }
  .photo-controls .button { flex: 1 1 100%; }
  input, textarea { font-size: 16px; }
  .save-bar { flex-wrap: wrap; }
  .save-bar .button { flex: 0 0 9.5rem; }
  .leave-actions .button { width: 100%; }
  main { padding-top: 24px; }
  .editor-layout { grid-template-columns: 1fr; }
  .preview-panel { position: static; max-height: none; }
  .three-columns { grid-template-columns: 1fr; }
  .recipe-heading, .editor-topbar { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 520px) {
  .search { flex-direction: column; }
  .recipe-grid { grid-template-columns: 1fr; }
  .site-header nav { gap: 10px; }
  .link-button { font-size: .85rem; }
}
