/* Shared geometry. Journal colours continue to come from the existing theme. */
:root{--ui-space-1:4px;--ui-space-2:8px;--ui-space-3:12px;--ui-space-4:16px;--ui-space-6:24px;--ui-control:44px;--ui-radius:16px;--ui-content:760px;--ui-gutter:max(16px,env(safe-area-inset-left,0px),env(safe-area-inset-right,0px))}
.btn-sm{box-sizing:border-box;min-height:var(--ui-control);display:inline-flex;align-items:center;justify-content:center;gap:var(--ui-space-2);line-height:1.45;border-radius:var(--ui-radius);vertical-align:middle}
.btn-sm:disabled{cursor:default;opacity:.55}
:where(button,a,input,textarea,summary):focus-visible{outline:2px solid var(--accent,#C94B31);outline-offset:3px}
:where(.detail-bar,.ugc-bar,.memo-bar,.settings-bar)>.round-btn{flex:0 0 var(--ui-control);width:var(--ui-control);height:var(--ui-control);display:grid;place-items:center}
#floatBar .search-pill,.knowledge-top .search-pill,.tasting-search-shell{box-sizing:border-box;min-height:52px;gap:var(--ui-space-2);border-radius:28px}
#floatBar .search-pill>.round-btn,.knowledge-top .search-pill>.round-btn{width:var(--ui-control);height:var(--ui-control);flex:0 0 var(--ui-control);display:grid;place-items:center}
#detailView .detail-bar,#ugcView .ugc-bar{box-sizing:border-box;width:100%;max-width:var(--ui-content);margin-inline:auto;padding-left:var(--ui-gutter);padding-right:var(--ui-gutter);gap:var(--ui-space-2)}
#detailView .detail-scroll{padding-inline:0}
#detailBody{box-sizing:border-box;width:100%;max-width:var(--ui-content);margin-inline:auto;padding-left:var(--ui-gutter);padding-right:var(--ui-gutter)}
#detailBody>.section{margin-top:var(--ui-space-6)}
#detailBody :where(h2,h3,p){overflow-wrap:anywhere}
#detailBody .recipe-actions{display:flex;flex-wrap:wrap;align-items:stretch;gap:var(--ui-space-2)}
#detailBody .recipe-actions>.btn-sm{flex:1 1 120px;min-width:0;padding:10px 14px}
#detailBody .ing-line{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:var(--ui-space-4);align-items:baseline}
#detailBody .ing-line.full{grid-template-columns:minmax(0,1fr)}
#detailBody .ing-amt{text-align:right;font-variant-numeric:tabular-nums}
#detailBody :where(.recipe-method,.recipe-materials,.recipe-preps,.recipe-reference){scroll-margin-top:16px}
.recipe-facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:var(--ui-space-3);margin:16px 0;padding:16px;border:1px solid var(--card-border,#e5e5e5);border-radius:var(--ui-radius)}
.recipe-facts>div{min-width:0}.recipe-facts dt{font-size:12px;color:var(--muted);margin-bottom:4px}.recipe-facts dd{font-size:14px;line-height:1.5;margin:0;overflow-wrap:anywhere}
.recipe-section-nav{display:flex;gap:8px;overflow-x:auto;margin:16px 0 0;padding-bottom:4px}.recipe-section-nav button{flex:none;min-height:40px;border:1px solid var(--card-border);border-radius:20px;padding:8px 16px;background:var(--card,#fff);color:var(--accent-deep)}
.recipe-reference{padding:16px;border:1px solid var(--card-border);border-radius:var(--ui-radius);margin-top:24px}.recipe-reference summary{cursor:pointer;font-weight:600;color:var(--accent-deep)}.recipe-reference p{font-size:14px;line-height:1.7}.recipe-reference a{display:block;margin-top:12px;overflow-wrap:anywhere}
.ingredient-knowledge{border:0;padding:0;background:none;color:var(--accent-deep);font:inherit;text-align:left;text-decoration:underline;text-decoration-color:var(--accent-tint-2);text-underline-offset:4px;cursor:pointer}
.knowledge-share-action{min-height:44px;border:1px solid var(--card-border);border-radius:16px;background:var(--card,#fff);color:var(--accent-deep);padding:8px 16px;margin:0 0 16px}
.normar-share{box-sizing:border-box;width:min(440px,calc(100vw - 32px));max-height:calc(100dvh - 32px);overflow-y:auto;padding:20px;border:1px solid var(--card-border);border-radius:24px;background:var(--card,#fff);color:var(--text);overscroll-behavior:contain}
.normar-share::backdrop{background:#0006}.normar-share header{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px}.normar-share h2{font-size:18px;margin:0}.normar-share [data-close]{width:44px;height:44px;border:0;background:transparent;color:inherit;font-size:24px}.normar-share img{display:block;width:100%;max-height:52dvh;object-fit:contain;border-radius:12px}.normar-share-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px}.normar-share-actions>*{flex:1 1 96px;min-height:44px;padding:10px 12px;text-align:center;border:1px solid var(--card-border);border-radius:16px;background:transparent;color:var(--accent-deep);font:inherit;text-decoration:none}.normar-share [role=status]{font-size:13px;line-height:1.6;color:var(--muted)}
@media(min-width:760px){:root{--ui-gutter:max(24px,env(safe-area-inset-left,0px),env(safe-area-inset-right,0px))}}
/* Facts stay compact instead of becoming another large card above the recipe. */
.recipe-facts{display:flex;flex-wrap:wrap;gap:8px 24px;padding:8px 0;border:0;margin:12px 0}
.recipe-facts>div{display:flex;align-items:baseline;gap:8px}.recipe-facts dt{margin:0;flex:none}
:root{--ui-card-radius:20px;--ui-dialog-radius:24px}
.cards>.card,.tasting-card,.knowledge-grid>.knowledge-entry,.tasting-category-grid>button{border-radius:var(--ui-card-radius)}
.lab-dialog,.normar-share{border-radius:var(--ui-dialog-radius)}
/* Full-screen layers use the viewport axis, without a reserved scrollbar strip. */
html.layer-cover{scrollbar-gutter:auto}
#detailView .detail-scroll{scrollbar-width:none}
#detailView .detail-scroll::-webkit-scrollbar{display:none}
html:has(.normar-share[open]),html:has(.lab-dialog[open]){scrollbar-gutter:auto;overflow:hidden}
.recipe-section-nav button{min-height:var(--ui-control)}
.knowledge-view.is-star-view :focus-visible{outline-color:#F0C879}
html[data-lab=caffeine] .knowledge-view.is-star-view :focus-visible{outline-color:#d7b89f}

/* Tag editor: selected labels remain visible while each group is folded. */
#sheetBody .sheet-fold{margin:0;padding:12px 0;border-bottom:1px solid var(--card-border,#e5e5e5)}
#sheetBody .tag-group-toggle{box-sizing:border-box;display:flex;width:100%;align-items:center;justify-content:space-between;gap:12px;min-height:44px;padding:4px 0;border:0;background:transparent;color:var(--text);font:inherit;font-weight:600;text-align:left}
#sheetBody .tag-group-meta{display:flex;align-items:center;gap:10px;color:var(--muted)}
#sheetBody .tag-group-meta small{font-size:12px;font-weight:400;font-variant-numeric:tabular-nums}
#sheetBody .tag-group-meta svg{width:18px;height:18px;transition:transform .18s ease}
#sheetBody .tag-group-toggle[aria-expanded=true] svg{transform:rotate(90deg)}
#sheetBody .sheet-fold .pill-row{gap:8px;padding:8px 0 4px}
#sheetBody .tag-selected:empty{display:none}
#sheetBody .pill-toggle{min-height:44px;line-height:1.4}
@media(prefers-reduced-motion:reduce){#sheetBody .tag-group-meta svg{transition:none}}
