/* password gate */
#gate { position: fixed; inset: 0; background: #fff; z-index: 9999; display: flex; align-items: center; justify-content: center; flex-direction: column; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
#gate.hidden { display: none; }
#gate .box { width: 300px; text-align: center; }
#gate h2 { font-size: 17px; margin: 0 0 4px; color: #1a1a1a; font-weight: 700; }
#gate p { font-size: 13px; color: #767676; margin: 0 0 16px; }
#gate input { font-size: 15px; padding: 11px 12px; border: 1px solid #cfcfcf; border-radius: 8px; width: 100%; box-sizing: border-box; }
#gate button { margin-top: 10px; padding: 10px 16px; background: #1d4e89; color: #fff; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; width: 100%; font-size: 14px; }
#gate .err { color: #c23b34; font-size: 13px; margin-top: 10px; min-height: 16px; }
body.gated { overflow: hidden; }
body.gated > *:not(#gate) { filter: blur(7px); pointer-events: none; }

/* edit bar */
#editbar { position: fixed; right: 16px; bottom: 16px; z-index: 9000; display: flex; gap: 8px; align-items: center; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
#editbar.hidden { display: none; }
#editToggle { padding: 9px 16px; background: #1a1a1a; color: #fff; border: none; border-radius: 20px; font-weight: 600; font-size: 13px; cursor: pointer; box-shadow: 0 3px 12px rgba(0,0,0,0.28); }
#editToggle.on { background: #4a9c6d; }
#saveStat { font-size: 12px; color: #555; background: #fff; padding: 6px 11px; border-radius: 14px; box-shadow: 0 1px 7px rgba(0,0,0,0.16); }
#saveStat.err { color: #c23b34; font-weight: 600; }
#saveStat.hidden { display: none; }

/* paragraphs emptied via the editor collapse in view mode (still editable in edit mode) */
body:not(.editing) [data-ekey]:empty { display: none; }

body.editing [data-ekey] { outline: 1px dashed rgba(29,78,137,0.45); outline-offset: 3px; border-radius: 2px; }
body.editing [data-ekey]:hover { background: rgba(29,78,137,0.05); }
body.editing [data-ekey]:focus { outline: 2px solid #1d4e89; background: #fff; cursor: text; }
