/* Layerbound M3.48.23 — shared autosaving notepad on every application page. */
#lbGlobalNotesToggle,
#lbGlobalNotesPanel {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-sizing: border-box;
}
#lbGlobalNotesToggle {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 2147483600;
  min-width: 92px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  color: #fff;
  background: rgba(24, 28, 38, .94);
  box-shadow: 0 8px 24px rgba(0,0,0,.34);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  touch-action: manipulation;
}
#lbGlobalNotesToggle[aria-expanded="true"] {
  background: #2c6686;
}
#lbGlobalNotesPanel {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(max(14px, env(safe-area-inset-bottom)) + 56px);
  z-index: 2147483599;
  display: flex;
  flex-direction: column;
  width: min(420px, calc(100vw - 28px));
  height: min(360px, calc(100vh - 112px));
  min-width: 270px;
  min-height: 210px;
  overflow: hidden;
  resize: both;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 14px;
  color: #f5f7fb;
  background: rgba(19, 22, 30, .98);
  box-shadow: 0 14px 40px rgba(0,0,0,.48);
}
#lbGlobalNotesPanel[hidden] { display: none !important; }
.lbGlobalNotesHead {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 10px 10px 9px 12px;
  border-bottom: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.055);
}
.lbGlobalNotesHead strong { margin-right: auto; font-size: 15px; }
.lbGlobalNotesStatus { color: #a9d9b5; font-size: 12px; white-space: nowrap; }
.lbGlobalNotesHead button {
  min-width: 38px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  color: #f5f7fb;
  background: rgba(255,255,255,.08);
  font: inherit;
}
#lbGlobalNotesText {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 13px;
  resize: none;
  border: 0;
  outline: none;
  color: #f7f8fb;
  background: rgba(8, 10, 15, .82);
  font: 15px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 2;
}
#lbGlobalNotesText::placeholder { color: rgba(235,240,250,.45); }
.lbGlobalNotesFoot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  padding: 7px 11px;
  color: rgba(235,240,250,.66);
  background: rgba(255,255,255,.035);
  font-size: 12px;
}
@media (max-width: 560px) {
  #lbGlobalNotesPanel {
    right: max(8px, env(safe-area-inset-right));
    bottom: calc(max(8px, env(safe-area-inset-bottom)) + 54px);
    width: calc(100vw - 16px);
    height: min(46vh, 380px);
    min-width: 0;
    resize: vertical;
  }
  #lbGlobalNotesToggle {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* M3.48.98 — keep Notes available without covering phone editor controls. */
:where(html[data-lb-display-profile="phone"],html.lbCompactEditor) #lbGlobalNotesToggle{
  right:max(5px,env(safe-area-inset-right));
  bottom:max(5px,env(safe-area-inset-bottom));
  min-width:32px;
  width:32px;
  min-height:32px;
  height:32px;
  padding:0;
  overflow:hidden;
  font-size:0;
  border-radius:50%;
}
:where(html[data-lb-display-profile="phone"],html.lbCompactEditor) #lbGlobalNotesToggle::before{content:'📝';font-size:15px}
:where(html[data-lb-display-profile="phone"],html.lbCompactEditor) #lbGlobalNotesPanel{
  right:max(5px,env(safe-area-inset-right));
  bottom:42px;
  width:min(320px,78vw);
  height:min(300px,55vh);
  min-width:0;
  min-height:160px;
}
/* P226H: keep Notes clear of editor bottom action rails. */
body:is(.lb-page-character,.lb-page-map) #lbGlobalNotesToggle,
body:has(.assetWorkshop) #lbGlobalNotesToggle{bottom:max(78px,calc(env(safe-area-inset-bottom) + 78px));}
body:is(.lb-page-character,.lb-page-map) #lbGlobalNotesPanel,
body:has(.assetWorkshop) #lbGlobalNotesPanel{bottom:max(134px,calc(env(safe-area-inset-bottom) + 134px));}


/* P226K — Character Workshop bottom shelf is ~126px high; keep Notes completely above it. */
body.lb-page-character #lbGlobalNotesToggle{bottom:max(148px,calc(env(safe-area-inset-bottom) + 148px))!important}
body.lb-page-character #lbGlobalNotesPanel{bottom:max(204px,calc(env(safe-area-inset-bottom) + 204px))!important}
