/* Notes board: a wall of sticky notes. Each note gets a soft paper tint from its id.
   The paper keeps dark ink in both themes; dark mode uses a dimmer paper so it does not glare. */
.nb-tools{display:flex;gap:10px;align-items:center;margin:20px 0 0}
.nb-tools input,.nb-tools select{min-height:44px;min-width:0;box-sizing:border-box;background:var(--panel);color:var(--ink);border:1px solid var(--line);border-radius:10px;padding:10px 12px;font:inherit;font-size:16px}
.nb-tools input{flex:1}
.nb-tools select{flex:0 1 220px}
.nb-tools :focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.nb-tidy{flex:none;min-height:44px;padding:10px 16px;border:1px solid var(--line);border-radius:999px;background:transparent;color:var(--ink);font:inherit;font-size:15px;white-space:nowrap;cursor:pointer}
.nb-tidy:hover{background:var(--line)}
.nb-new{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;padding:10px 18px;border:0;border-radius:999px;background:var(--accent);color:#0a0b0c;font:inherit;font-size:15px;font-weight:700;white-space:nowrap;cursor:pointer;box-shadow:0 8px 20px -12px rgba(0,0,0,.7);transition:filter .16s ease,transform .12s ease}
.nb-new span{font-size:20px;line-height:1;font-weight:500}
.nb-new:hover{filter:brightness(1.08)}
.nb-new:active{transform:scale(.97)}
.nb-new:focus-visible{outline:2px solid var(--ink);outline-offset:3px}
html.light .nb-new{background:color-mix(in srgb,var(--accent) 86%,#000);color:#fff}
.nb-help{margin:12px 0 0;font-size:13px;line-height:1.45;color:var(--muted)}
.nb-help .nb-mouse{display:none}
@media(hover:hover) and (pointer:fine){.nb-help .nb-touch{display:none}.nb-help .nb-mouse{display:inline}}
.nb-sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* A corkboard: notes.js places each note (left, top, size, stacking) and sets the board's height to fit the lowest one. */
.nb-board{position:relative;isolation:isolate;list-style:none;margin:20px 0 0;padding:0}
.nb-note{--hue:#f2c94c;--tilt:0deg;--paper:#c9c3b8;--nb-ink:#1f2b28;position:absolute;rotate:var(--tilt);border-radius:3px 3px 16px 3px;color:var(--nb-ink);
 background:#ddd3b2;background:linear-gradient(color-mix(in srgb,var(--hue) 22%,transparent),transparent 26px),color-mix(in srgb,var(--hue) 38%,var(--paper));
 box-shadow:0 1px 1px rgba(0,0,0,.25),0 12px 20px -12px rgba(0,0,0,.75);
 transition:rotate .2s ease,scale .2s cubic-bezier(.2,.8,.2,1),box-shadow .2s ease}
:is(.nb-note,.nt-chip)[data-tint="0"]{--hue:#f2c94c;--tilt:-.6deg}
:is(.nb-note,.nt-chip)[data-tint="1"]{--hue:#f08a5d;--tilt:.5deg}
:is(.nb-note,.nt-chip)[data-tint="2"]{--hue:#6fcf97;--tilt:-.3deg}
:is(.nb-note,.nt-chip)[data-tint="3"]{--hue:#5aa7f0;--tilt:.7deg}
:is(.nb-note,.nt-chip)[data-tint="4"]{--hue:#b98af0;--tilt:-.5deg}
html.light .nb-note{--paper:#fffdf8;box-shadow:0 1px 1px rgba(31,43,40,.12),0 10px 18px -12px rgba(31,43,40,.45)}
.nb-note.archived{opacity:.66}
@media(hover:hover){.nb-note:hover{rotate:0deg;box-shadow:0 2px 3px rgba(0,0,0,.18),0 18px 26px -14px rgba(0,0,0,.6)}}
/* The whole note is the button: tap opens it, a long press lifts it. No text selection or iOS callout on a press. */
.nb-open{all:unset;box-sizing:border-box;display:flex;flex-direction:column;gap:6px;width:100%;height:100%;padding:14px 14px 12px;color:var(--nb-ink);text-align:left;cursor:pointer;
 -webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;touch-action:manipulation}
.nb-open:focus-visible{outline:2px solid var(--ink);outline-offset:3px;border-radius:3px 3px 16px 3px}
.nb-title{font-size:15px;font-weight:700;line-height:1.28;letter-spacing:-.01em;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere}
.nb-text{font-size:13px;line-height:1.42;color:color-mix(in srgb,var(--nb-ink) 80%,transparent);white-space:pre-line;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;overflow-wrap:anywhere}
.nb-foot{margin-top:auto;display:flex;gap:6px;align-items:center;min-width:0}
.nb-chip,.nb-mark{display:inline-flex;align-items:center;gap:5px;min-width:0;padding:3px 8px;border-radius:999px;font-size:12px;line-height:1.3;border:1px solid color-mix(in srgb,var(--nb-ink) 22%,transparent);background:rgba(255,255,255,.28)}
.nb-chip{flex:0 1 auto}
.nb-chip b{flex:none;font-weight:700}
.nb-chip span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nb-mark{flex:none;color:color-mix(in srgb,var(--nb-ink) 85%,transparent)}
/* Lifted: bigger, tilted, deeper shadow. translate is set inline every frame, so it never transitions. */
.nb-note.is-lifted{z-index:1000!important;scale:1.06;rotate:-2deg;box-shadow:0 3px 6px rgba(0,0,0,.2),0 30px 44px -16px rgba(0,0,0,.65);transition:rotate .18s ease,scale .18s cubic-bezier(.2,.8,.2,1),box-shadow .18s ease}
html.nb-dragging,html.nb-dragging *{cursor:grabbing!important;-webkit-user-select:none;user-select:none}
.nb-note.is-new{animation:nbIn .44s cubic-bezier(.2,.9,.25,1.15) both}
@keyframes nbIn{from{opacity:0;scale:.82;translate:0 -12px}}
.nb-empty{margin-top:18px;border:1px dashed var(--line);border-radius:14px;padding:40px 22px;text-align:center;color:var(--muted)}
.nb-empty b{display:block;color:var(--ink);font-size:18px;margin-bottom:6px}
.nb-empty p{margin:0 auto 16px;max-width:42ch;font-size:14px;line-height:1.5}
/* Phones: New note floats above the tab bar, where the thumb is. */
@media(max-width:767px){
 .nb-tools .nb-new{position:fixed;right:max(16px,env(safe-area-inset-right));bottom:calc(76px + env(safe-area-inset-bottom));z-index:40;min-height:52px;padding:12px 20px;font-size:16px;box-shadow:0 14px 30px -10px rgba(0,0,0,.7)}
 .nb-tools{flex-wrap:wrap}
 .nb-tools input{flex-basis:100%}
 .nb-tools select{flex:1 1 0}
 .nb-board{margin-bottom:76px}
}

/* The note window: centred on wide screens, a bottom sheet on phones. The dialog box
   itself is transparent and sized to the visual viewport (see nFitDialog), so the
   sheet and its Save button stay above the iPhone keyboard. */
html:has(.nd[open]){overflow:hidden}
.nd{position:fixed;inset:var(--nd-top,0px) auto auto 0;width:100%;height:var(--nd-h,100dvh);max-width:none;max-height:none;margin:0;padding:16px;border:0;background:transparent;color:var(--ink);box-sizing:border-box;overflow:hidden}
.nd[open]{display:flex;align-items:center;justify-content:center}
.nd::backdrop{background:rgba(0,0,0,.55)}
.nd-sheet{display:flex;flex-direction:column;width:min(560px,100%);max-height:min(820px,100%);background:var(--panel);border:1px solid var(--line);border-radius:16px;box-shadow:0 30px 80px -20px rgba(0,0,0,.7);overflow:hidden;animation:ndIn .24s cubic-bezier(.2,.8,.2,1)}
.nd-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 10px 10px 20px;border-bottom:1px solid var(--line)}
.nd-head h2{margin:0;font-size:18px;font-weight:700;letter-spacing:0;text-transform:none;color:var(--ink)}
.nd-x{display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;border-radius:12px;background:transparent;color:var(--muted);cursor:pointer}
.nd-x:hover{background:var(--line);color:var(--ink)}
.nd-body{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:16px 20px 18px;display:grid;gap:14px;align-content:start;grid-template-columns:minmax(0,1fr)}
.nd-field{display:grid;gap:6px;min-width:0}
.nd-field>span{font-size:13px;font-weight:600;color:var(--muted)}
.nd input,.nd textarea,.nd select{width:100%;min-width:0;box-sizing:border-box;min-height:46px;margin:0;background:var(--bg);color:var(--ink);border:1px solid var(--line);border-radius:10px;padding:10px 12px;font:inherit;font-size:16px}
.nd textarea{min-height:150px;resize:vertical;line-height:1.55}
.nd :is(input,textarea,select,button):focus-visible{outline:2px solid var(--accent);outline-offset:1px}
.nd-pair{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}
.nd-pickwrap{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;margin-top:-4px}
.nd-pickwrap[hidden],.nd-attached[hidden],.nd-pickbox[hidden]{display:none}
.nd-pickbox{display:grid;gap:8px}
/* After a pick the list folds into this line, so the choice is plain to see. */
.nd-attached{display:flex;align-items:center;gap:10px;min-height:52px;padding:4px 4px 4px 12px;border:1px solid color-mix(in srgb,var(--accent) 55%,transparent);border-radius:10px;background:color-mix(in srgb,var(--accent) 12%,transparent)}
.nd-attached-text{flex:1;min-width:0;font-size:15px;line-height:1.35;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nd-attached button{flex:none;min-height:44px;padding:8px 14px;border:1px solid var(--line);border-radius:8px;background:var(--panel);color:var(--ink);font:inherit;font-size:15px;cursor:pointer}
.nd-picks{max-height:240px;overflow:auto;overscroll-behavior:contain;border:1px solid var(--line);border-radius:10px;background:var(--bg)}
/* The whole row is one button: a single click or tap picks it. */
.nd-pick{display:flex;align-items:center;gap:12px;width:100%;min-height:48px;margin:0;padding:8px 12px;border:0;border-bottom:1px solid var(--line);border-radius:0;background:transparent;color:var(--ink);font:inherit;text-align:left;cursor:pointer}
.nd-pick:hover{background:color-mix(in srgb,var(--ink) 6%,transparent)}
.nd-pick>span{display:grid;min-width:0;flex:1}
.nd-pick b{font-size:14px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nd-pick small{font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nd-pick[aria-pressed="true"]{background:color-mix(in srgb,var(--accent) 22%,transparent);box-shadow:inset 4px 0 0 var(--accent)}
.nd-pick[aria-pressed="true"]::after{content:'✓';flex:none;font-weight:700;color:var(--accent)}
.nd-more{width:100%;min-height:48px;border:0;background:transparent;color:var(--accent);font:inherit;font-size:14px;font-weight:600;cursor:pointer}
.nd-hint{margin:0;padding:12px;font-size:13px;line-height:1.45;color:var(--muted)}
.nd-hint.bad{color:var(--red)}
.nd-retry{margin:0 12px 12px;min-height:44px;padding:8px 14px;border:1px solid var(--line);border-radius:10px;background:transparent;color:var(--ink);font:inherit;cursor:pointer}
.nd-actions{display:flex;flex-wrap:wrap;gap:8px;padding-top:14px;border-top:1px solid var(--line)}
.nd-actions button{min-height:44px;padding:9px 14px;border:1px solid var(--line);border-radius:10px;background:transparent;color:var(--ink);font:inherit;font-size:14px;cursor:pointer;transition:background .16s ease}
.nd-actions button:hover:not(:disabled){background:var(--line)}
.nd-actions button:disabled{opacity:.4;cursor:default}
.nd-actions .nd-danger{color:var(--red);border-color:color-mix(in srgb,var(--red) 55%,transparent)}
.nd-error{margin:0;color:var(--red);font-size:13px;line-height:1.45}
.nd-error:empty{display:none}
.nd-foot{display:flex;gap:10px;justify-content:flex-end;padding:12px 20px max(12px,env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--panel)}
.nd-foot button{min-height:48px;padding:10px 18px;border-radius:12px;font:inherit;font-size:16px;cursor:pointer}
.nd-cancel{border:1px solid var(--line);background:transparent;color:var(--ink)}
.nd-save{min-width:140px;border:0;background:var(--accent);color:#0a0b0c;font-weight:700}
html.light .nd-save{background:color-mix(in srgb,var(--accent) 86%,#000);color:#fff}
.nd-save:disabled{opacity:.45;cursor:default}
@keyframes ndIn{from{opacity:0;scale:.97}}
@keyframes ndUp{from{translate:0 100%}}
@media(max-width:767px){
 .nd{padding:0}
 .nd[open]{align-items:flex-end}
 .nd-sheet{width:100%;max-height:calc(100% - 10px - env(safe-area-inset-top));border-radius:18px 18px 0 0;border-bottom:0;animation-name:ndUp;animation-duration:.28s}
 .nd-body{padding:14px 16px 16px}
 .nd-head{padding-left:16px}
 .nd-foot{padding-left:16px;padding-right:16px}
 .nd-foot button{flex:1}
 .nd textarea{min-height:120px}
 .nd-picks{max-height:212px}
}

/* Notes on a script (Prompter and Scripts): a badge with the count, sticky chips above the
   script text, and a chooser when there are several. Chips use the board's paper and tint. */
.nt-ico{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.nt-ind{position:relative;display:inline-flex;align-items:center;gap:3px;padding:1px 8px 1px 5px;border:1px solid color-mix(in srgb,var(--accent) 45%,transparent);border-radius:999px;background:color-mix(in srgb,var(--accent) 14%,transparent);color:var(--ink);font-size:12px;font-weight:700;line-height:1.5;white-space:nowrap;cursor:pointer}
.nt-ind .nt-ico{width:15px;height:15px;color:var(--accent)}
/* The badge is small; the spot a thumb can hit is not. */
.nt-ind::after{content:'';position:absolute;inset:-12px -8px}
.nt-chips{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}
.nt-chips:empty{display:none}
.nt-chip{--hue:#f2c94c;--paper:#c9c3b8;display:grid;align-content:center;gap:1px;flex:0 1 auto;max-width:min(100%,240px);min-width:44px;min-height:44px;box-sizing:border-box;padding:6px 10px;border:0;border-radius:3px 3px 10px 3px;background:color-mix(in srgb,var(--hue) 38%,var(--paper));color:#1f2b28;font:inherit;text-align:left;cursor:pointer;box-shadow:0 1px 1px rgba(0,0,0,.25),0 6px 12px -8px rgba(0,0,0,.6);-webkit-tap-highlight-color:transparent}
html.light .nt-chip{--paper:#fffdf8;box-shadow:0 1px 1px rgba(31,43,40,.12),0 6px 12px -8px rgba(31,43,40,.4)}
.nt-chip b,.nt-chip small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nt-chip b{font-size:14px;font-weight:700;line-height:1.3}
.nt-chip small{font-size:12px;line-height:1.35;color:rgba(31,43,40,.8)}
.nt-chip:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.nt-chip.nt-more{background:transparent;border:1px solid var(--line);color:var(--ink);box-shadow:none;font-size:14px;font-weight:600}
.nt-list .nt-chip{max-width:none;width:100%;min-height:52px;padding:8px 12px}

@media(prefers-reduced-motion:reduce){
 .nb-note,.nb-note.is-lifted,.nb-new{transition:none}
 .nb-note{rotate:0deg}
 .nb-note.is-new,.nd-sheet{animation:none}
}
