/* notes.css - My Notes: the list, the opened note, the editor and the three display styles (Sticky, Notebook,
   Category Accent). Loaded right after styles.css (index.html), cached for offline use (service-worker.js).
   One rule per selector (tests/unit/lint.test.js checks it): to change how something looks, edit its rule where it
   is - never add an override further down. Order still matters between DIFFERENT selectors of the same weight, so a
   rule moved up or down can change the look; check the notes screens after moving one. */

/* ---------- My Notes ---------- */
/* Note colours tint the card from the theme's own card colour, so they read right in dark and light. */

/* A page's notes in its header: little sticky notes in their own colours, stacked when there are several */
.page-note-btn { position: relative; flex: 0 0 auto; width: 30px; height: 30px; margin-left: 4px; padding: 0; display: inline-grid; place-items: center; border: 0; background: transparent; cursor: pointer; animation: qnPop 0.4s cubic-bezier(.2, 1.4, .4, 1); -webkit-tap-highlight-color: transparent; }
.page-note-btn .qn-stack { width: 19px; height: 19px; transition: transform 0.15s ease; }
.page-note-btn:active .qn-stack { transform: scale(0.88) rotate(-4deg); }
.page-note-btn .page-note-count { position: absolute; top: -2px; right: -5px; min-width: 15px; height: 15px; padding: 0 4px; box-sizing: border-box; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 0.58rem; font-weight: 800; line-height: 15px; text-align: center; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
@keyframes qnPop { from { transform: scale(0.4) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
/* The sticky note itself: paper with a soft fold at the bottom-right corner and a shadow under it */
.qn-stack { position: relative; display: inline-block; width: 20px; height: 20px; flex: 0 0 auto; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.22)) drop-shadow(0 3px 4px rgba(0, 0, 0, 0.22)); }
.qn-stack.is-big { width: 50px; height: 50px; }
.qn-sticky { position: absolute; inset: 0; border-radius: 2px; background: linear-gradient(165deg, var(--qn-paper) 0%, var(--qn-paper) 50%, var(--qn-paper2) 100%); clip-path: polygon(0 0, 100% 0, 100% 72%, 72% 100%, 0 100%); }
.qn-sticky::before { content: ''; position: absolute; left: 20%; right: 22%; top: 34%; height: 18%; border-top: 1.5px solid rgba(15, 23, 42, 0.13); border-bottom: 1.5px solid rgba(15, 23, 42, 0.13); }
.qn-sticky::after { content: ''; position: absolute; right: 0; bottom: 0; width: 28%; height: 28%; background: linear-gradient(135deg, rgba(255, 255, 255, 0.35), rgba(15, 23, 42, 0.28)); clip-path: polygon(0 0, 100% 0, 0 100%); }
.qn-sticky.s0 { z-index: 3; transform: rotate(-5deg); }
.qn-sticky.s1 { z-index: 2; transform: translate(22%, -16%) rotate(9deg); filter: brightness(0.96); }
.qn-sticky.s2 { z-index: 1; transform: translate(-20%, -10%) rotate(-15deg); filter: brightness(0.92); }
.qn-stack.n1 .qn-sticky.s0 { transform: rotate(-6deg); }

/* Page */

.qn-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; margin-bottom: 12px; border-radius: 18px; border: 1px solid var(--line); background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, #fbbf24 22%, transparent), transparent 60%), radial-gradient(120% 140% at 100% 100%, color-mix(in srgb, #a78bfa 22%, transparent), transparent 60%), var(--card); }
.qn-hero-k { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.qn-hero-v { font-size: 1.35rem; font-weight: 800; color: var(--text); margin-top: 2px; }
.qn-hero-s { font-size: 0.72rem; font-weight: 600; color: var(--muted); margin-top: 3px; }
.qn-search { width: 100%; box-sizing: border-box; margin: 0 0 10px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 0.85rem; }
.qn-filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px 12px; padding: 0 2px 2px; }
.qn-filters::-webkit-scrollbar { display: none; }
.qn-filter { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font: inherit; font-size: 0.72rem; font-weight: 700; cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.qn-filter b { font-size: 0.64rem; padding: 0 6px; border-radius: 999px; background: var(--card-2); color: var(--muted); }
.qn-filter.is-on { background: var(--text); border-color: var(--text); color: var(--bg); }
.qn-filter.is-on b { background: color-mix(in srgb, var(--bg) 25%, transparent); color: var(--bg); }
.qn-grid { column-count: 2; column-gap: 10px; }
.qn-grid.is-empty { column-count: 1; }
@media (min-width: 720px) { .qn-grid { column-count: 3; } }

/* Card */

.qn-card:active { transform: scale(0.98); }
@keyframes qnIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.qn-card.is-expired { opacity: 0.62; filter: saturate(0.6); }
.qn-pin { position: absolute; top: 8px; right: 9px; font-size: 0.8rem; }
.qn-pin-t { position: absolute; top: 4px; right: 4px; z-index: 1; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; font-size: 0.8rem; line-height: 1; cursor: pointer; filter: grayscale(1); opacity: 0.3; transition: opacity 0.2s ease, filter 0.2s ease, transform 0.15s ease; -webkit-tap-highlight-color: transparent; }
.qn-pin-t.is-on { filter: none; opacity: 1; }
.qn-pin-t:active { transform: scale(0.8); }
.qn-pin-t + .qn-text, .qn-pin-t + .qn-list > .qn-li:first-child { padding-right: 22px; }
.qn-title { font-size: 0.9rem; font-weight: 800; line-height: 1.3; margin: 0 18px 4px 0; word-break: break-word; }
.qn-text { font-size: 0.8rem; line-height: 1.45; color: var(--text); white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden; }
.qn-card.is-full .qn-text { -webkit-line-clamp: unset; display: block; }

.qn-chip { padding: 2px 7px; border-radius: 999px; background: color-mix(in srgb, var(--qn) 16%, transparent); color: var(--text); font-size: 0.62rem; font-weight: 700; white-space: nowrap; }
.qn-exp { background: var(--card-2); color: var(--muted); }
.qn-exp.is-soon { background: color-mix(in srgb, #f59e0b 22%, transparent); color: #b45309; }
html:not([data-theme="light"]) .qn-exp.is-soon { color: #fcd34d; }
.qn-exp.is-gone { background: color-mix(in srgb, #ef4444 18%, transparent); color: var(--bad); }
.qn-when { margin-left: auto; font-size: 0.6rem; font-weight: 600; color: var(--muted); }
.qn-empty { text-align: center; padding: 28px 18px; border-radius: 18px; border: 1px dashed var(--line); background: var(--card); }
.qn-empty-ico { font-size: 2.2rem; }
.qn-empty-t { font-size: 0.95rem; font-weight: 800; color: var(--text); margin: 6px 0 2px; }
.qn-empty p { font-size: 0.78rem; color: var(--muted); margin: 6px 0 12px; }
.qn-expired-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.qn-expired-foot .hint { margin: 0; }

/* Editor */
.qn-editor { background: var(--qn-bg); transition: background 0.25s ease; }

.qn-colors { display: flex; gap: 8px; flex-wrap: wrap; }
.qn-dot { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--qn) 60%, transparent); background: color-mix(in srgb, var(--qn) 45%, var(--card)); cursor: pointer; transition: transform 0.15s ease, box-shadow 0.2s ease; }
.qn-dot.qn-c-plain { background: var(--card); border-color: var(--line); }
.qn-dot.is-on { transform: scale(1.12); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--qn); }
.qn-pin-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 1rem; cursor: pointer; filter: grayscale(1); opacity: 0.6; transition: all 0.2s ease; }
.qn-pin-btn.is-on { filter: none; opacity: 1; border-color: #f59e0b; background: color-mix(in srgb, #fbbf24 22%, var(--card)); }
.qn-ed-title { width: 100%; box-sizing: border-box; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; font-size: 1.05rem; font-weight: 800; padding: 8px 2px; outline: none; }
.qn-ed-text { width: 100%; box-sizing: border-box; min-height: 120px; margin-top: 8px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 0.92rem; line-height: 1.5; padding: 6px 2px; resize: none; outline: none; }
.qn-ed-sec { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.qn-ed-k { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.qn-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.qn-opt { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 0.72rem; font-weight: 700; cursor: pointer; transition: background 0.2s ease, border-color 0.2s ease; }
.qn-opt.is-on { border-color: var(--qn); background: color-mix(in srgb, var(--qn) 26%, var(--card)); box-shadow: inset 0 0 0 1px var(--qn); }
.qn-editor.qn-c-plain .qn-opt.is-on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, var(--card)); box-shadow: inset 0 0 0 1px var(--accent); }
.qn-custom { margin-top: 8px; width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; }
.qn-ed-hint { margin: 8px 0 0; font-size: 0.66rem; color: var(--muted); }

/* A page's notes, floating in the middle of the screen: just the notes, as sticky paper on a blurred backdrop */
.modal-host:has(> .qn-float) { align-items: stretch; background: rgba(4, 9, 20, 0.55); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); }
.qn-float { --text: #1e293b; --muted: #5b6474; --line: rgba(15, 23, 42, 0.14); --card: rgba(255, 255, 255, 0.55); --card-2: rgba(15, 23, 42, 0.07);
  flex: 1; min-width: 0; display: flex; flex-direction: column; box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain;
  padding: calc(28px + var(--safe-top)) 16px calc(18px + var(--safe-bottom)); }
.qn-float-list { width: 100%; max-width: 400px; margin: auto; display: flex; flex-direction: column; gap: 16px; }
.qn-float-hint { flex: 0 0 auto; margin: 16px auto 0; font-size: 0.68rem; font-weight: 600; color: rgba(255, 255, 255, 0.7); text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.qn-fl { --rot: -0.8deg; position: relative; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.16)) drop-shadow(0 14px 20px rgba(0, 0, 0, 0.36));
  animation: qnFloatIn 0.45s cubic-bezier(.2, .9, .3, 1.12) backwards; transition: opacity 0.25s ease, transform 0.25s ease; }
.qn-fl:nth-child(even) { --rot: 0.9deg; }
@keyframes qnFloatIn { from { opacity: 0; transform: translateY(-26px) scale(0.86) rotate(-5deg); } to { opacity: 1; transform: none; } }
.qn-float .qn-card { margin: 0; padding: 16px 16px 14px; border: 0; border-radius: 3px; color: var(--text); box-shadow: none; cursor: default; animation: none;
  background: linear-gradient(172deg, var(--qn-paper) 0%, var(--qn-paper) 55%, color-mix(in srgb, var(--qn-paper) 70%, var(--qn-paper2)) 100%);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%); transform: rotate(var(--rot));
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.qn-float .qn-card::after { content: ''; position: absolute; right: 0; bottom: 0; width: 20px; height: 20px; background: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(15, 23, 42, 0.24)); clip-path: polygon(0 0, 100% 0, 0 100%); }
.qn-float .qn-card:active { transform: rotate(var(--rot)) scale(0.985); }
.qn-float .qn-exp.is-soon { color: #b45309; }
.qn-float .qn-card.is-back { animation: qnSettle 0.32s ease both; }
@keyframes qnSettle { from { transform: none; } to { transform: rotate(var(--rot)); } }
/* Double-tapped: it straightens and lifts, the others step back, and it opens up for writing */
.qn-float .qn-card.is-editing { transform: none; cursor: auto; -webkit-user-select: text; user-select: text; animation: qnLift 0.32s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes qnLift { from { transform: rotate(var(--rot)); } to { transform: none; } }
.qn-float .qn-card.is-editing > * { animation: qnFade 0.3s ease both; }
@keyframes qnFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.qn-fl.is-on { z-index: 2; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.2)) drop-shadow(0 24px 34px rgba(0, 0, 0, 0.45)); }
.qn-float.is-editing .qn-fl:not(.is-on) { opacity: 0.35; transform: scale(0.97); pointer-events: none; }
.qn-in-title { display: block; width: 100%; box-sizing: border-box; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 0.95rem; font-weight: 800; padding: 0 0 6px; outline: none; }
.qn-in-text { display: block; width: 100%; box-sizing: border-box; min-height: 64px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 0.86rem; line-height: 1.5; padding: 0; resize: none; outline: none; }
.qn-in-title::placeholder, .qn-in-text::placeholder { color: color-mix(in srgb, var(--text) 40%, transparent); }
.qn-float .qn-ed-list { margin-top: 0; }
.qn-in-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.qn-in-colors { display: flex; flex-wrap: wrap; gap: 7px; }
.qn-in-colors .qn-dot { width: 18px; height: 18px; border-width: 1.5px; }
.qn-float .qn-dot.is-on { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 0 3.5px var(--qn); }
.qn-float .qn-dot.qn-c-plain { background: #f8fafc; }
.qn-in-r { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.qn-in-more { width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 1rem; line-height: 1; cursor: pointer; }
.qn-in-done { border: 0; border-radius: 999px; padding: 7px 15px; background: #1e293b; color: #fff; font: inherit; font-size: 0.74rem; font-weight: 800; cursor: pointer; transition: transform 0.15s ease; }
.qn-in-done:active { transform: scale(0.95); }
@media (prefers-reduced-motion: reduce) { .qn-fl, .qn-float .qn-card, .qn-float .qn-card.is-editing > * { animation: none !important; } }

/* My Notes: quick capture, tools, sections */
.qn-hero-art { flex: 0 0 auto; padding: 4px 10px 0 0; }
.qn-compose { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 6px 6px 6px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); box-shadow: 0 4px 14px -8px rgba(0, 0, 0, 0.4); }
.qn-compose-in { flex: 1; text-align: left; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.9rem; font-weight: 600; padding: 9px 0; cursor: text; }
.qn-compose-b { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; border: 0; background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; font-size: 1.1rem; cursor: pointer; box-shadow: 0 6px 14px -6px rgba(249, 115, 22, 0.6); transition: transform 0.15s ease; }
.qn-compose-b:active { transform: scale(0.94); }
.qn-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.qn-tools .qn-search { margin: 0; flex: 1; }
.qn-view { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 1rem; cursor: pointer; }

.qn-empty-art { display: flex; justify-content: center; margin: 4px 0 10px; }
.qn-empty-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* Checklists on cards and in the popup: tick straight from here */

.qn-li-t { flex: 1; min-width: 0; word-break: break-word; }
.qn-li.is-done .qn-li-t { text-decoration: line-through; color: var(--muted); }
.qn-li-a { flex: 0 0 auto; font-size: 0.72rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.qn-cb { position: relative; flex: 0 0 auto; width: 17px; height: 17px; margin-top: 1px; padding: 0; border-radius: 5px; border: 1.7px solid color-mix(in srgb, var(--qn) 75%, var(--muted)); background: transparent; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease; }
.qn-c-plain .qn-cb { border-color: var(--muted); }
.qn-cb.is-on { background: var(--qn); border-color: var(--qn); }
.qn-c-plain .qn-cb.is-on { background: var(--accent); border-color: var(--accent); }
.qn-cb.is-on::after { content: ''; position: absolute; left: 4.5px; top: 1px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.qn-cb:active { transform: scale(0.86); }

.qn-li-sep { margin: 6px 0 1px; font-size: 0.62rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.qn-prog { height: 4px; border-radius: 999px; background: color-mix(in srgb, var(--qn) 18%, var(--card-2)); overflow: hidden; margin-top: 6px; }
.qn-prog span { display: block; height: 100%; border-radius: 999px; background: var(--qn); transition: width 0.3s ease; }
.qn-c-plain .qn-prog span { background: var(--accent); }
.qn-li-sum { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-top: 4px; font-size: 0.74rem; font-weight: 800; }
.qn-li-sum-t { color: var(--muted); font-weight: 700; font-size: 0.68rem; }

/* Editor: text / checklist, list rows, extras */
.qn-ed-top-r { display: flex; align-items: center; gap: 8px; }
.qn-type { display: inline-flex; padding: 2px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }
.qn-type button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.7rem; font-weight: 800; padding: 5px 9px; border-radius: 999px; cursor: pointer; transition: background 0.2s ease, color 0.2s ease; }
.qn-type button.is-on { background: var(--text); color: var(--bg); }
.qn-ed-list { display: flex; flex-direction: column; margin-top: 6px; }
.qn-ed-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.qn-ed-row .qn-cb { margin-top: 0; }
.qn-ed-it { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 0.9rem; padding: 8px 2px; outline: none; }
.qn-ed-row.is-done .qn-ed-it { text-decoration: line-through; color: var(--muted); }
.qn-ed-amt { flex: 0 0 78px; width: 78px; box-sizing: border-box; border: 1px solid transparent; border-radius: 8px; background: color-mix(in srgb, var(--card) 70%, transparent); color: var(--text); font: inherit; font-size: 0.8rem; padding: 5px 7px; text-align: right; -moz-appearance: textfield; }
.qn-ed-amt::-webkit-outer-spin-button, .qn-ed-amt::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qn-ed-amt:focus { border-color: var(--qn); outline: none; }
.qn-ed-x { flex: 0 0 auto; width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.15rem; line-height: 1; cursor: pointer; }
.qn-ed-add { align-self: flex-start; margin-top: 6px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 0.84rem; font-weight: 700; padding: 6px 2px; cursor: pointer; opacity: 0.85; }
.qn-ed-ticked { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.qn-ed-tog { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.76rem; font-weight: 800; padding: 4px 0; cursor: pointer; }
.qn-ed-mini { border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--muted); font: inherit; font-size: 0.66rem; font-weight: 700; padding: 3px 9px; cursor: pointer; }
.qn-ed-sum { margin-top: 8px; font-size: 0.72rem; font-weight: 800; color: var(--muted); }
.qn-ed-sum:empty { display: none; }
.qn-ed-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.qn-act { border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); font: inherit; font-size: 0.72rem; font-weight: 700; padding: 7px 10px; cursor: pointer; }
.qn-act.is-danger { color: var(--bad); }
.qn-ed-stamp { margin: 10px 0 0; font-size: 0.64rem; color: var(--muted); }

/* ---- Note text formatting (v1052): a quiet toolbar over a formatted box ---- */
.qn-rt { margin-top: 8px; position: relative; }
.qn-rt-bar { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; overflow-x: auto; scrollbar-width: none;
  background: color-mix(in srgb, var(--text) 5%, transparent); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); transition: border-color 0.2s, background 0.2s; }
.qn-rt-bar::-webkit-scrollbar { display: none; }
.qn-rt.is-focus .qn-rt-bar { border-color: color-mix(in srgb, var(--qn, var(--accent)) 45%, var(--line)); }
.qn-rt-btn { flex: 0 0 auto; width: 34px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  font: 700 0.95rem/1 Georgia, 'Times New Roman', serif; cursor: pointer; transition: background 0.15s, color 0.15s; }
.qn-rt-btn svg { width: 18px; height: 18px; fill: currentColor; }
.qn-rt-btn:hover { color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); }
.qn-rt-btn.is-on { color: var(--text); background: color-mix(in srgb, var(--qn, var(--accent)) 26%, transparent); }
.qn-rt-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.qn-rt-bold { font-weight: 900; }
.qn-rt-italic { font-style: italic; font-weight: 600; }
.qn-rt-underline { text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.qn-rt-strikeThrough { text-decoration: line-through; font-weight: 600; }
.qn-rt-heading { font-family: inherit; font-weight: 800; font-size: 0.9rem; letter-spacing: 0.02em; }
.qn-rt-sep { flex: 0 0 1px; width: 1px; height: 18px; margin: 0 4px; background: var(--line); }

.qn-rt-box.is-empty::before { content: attr(data-placeholder); color: color-mix(in srgb, var(--text) 40%, transparent); pointer-events: none; position: absolute; }
.qn-in-rt { margin-top: 4px; }
.qn-in-rt .qn-rt-bar { padding: 2px; }
.qn-in-rt .qn-rt-btn { width: 30px; height: 28px; font-size: 0.85rem; }
.qn-in-rt .qn-rt-box { min-height: 64px; max-height: 50vh; font-size: 0.86rem; padding: 8px 0 2px; }
/* Formatted text, the same in the editor and on a card. */
.qn-rich h3, .qn-rich h4 { margin: 4px 0 2px; font-size: 1.08em; font-weight: 800; line-height: 1.3; }
.qn-rich ul, .qn-rich ol { margin: 2px 0; padding-left: 1.35em; }
.qn-rich li { margin: 1px 0; padding-left: 2px; }
.qn-rich li::marker { color: var(--qn, var(--muted)); font-weight: 700; }
.qn-rich b { font-weight: 800; }
.qn-rich u { text-underline-offset: 2px; }
.qn-rich s { opacity: 0.7; }
.qn-text.qn-rich { white-space: normal; }
.qn-text.qn-rich > div:empty, .qn-text.qn-rich > div > br:only-child { min-height: 0.6em; }

/* Show on: folded to one line until tapped. */
.qn-fold-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.qn-fold-head .qn-ed-k { margin: 0; flex: 0 0 auto; }
.qn-fold-now { flex: 1; min-width: 0; font-size: 0.8rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.qn-fold-chev { flex: 0 0 auto; font-size: 1.2rem; line-height: 1; color: var(--muted); transition: transform 0.2s; }
.qn-fold.is-open .qn-fold-chev { transform: rotate(90deg); }
.qn-fold-body { display: none; padding-top: 10px; }
.qn-fold.is-open .qn-fold-body { display: block; }
/* Disappears: one row that scrolls sideways. */
.qn-chips.is-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 1px 2px 3px; scroll-snap-type: x proximity; }
.qn-chips.is-row::-webkit-scrollbar { display: none; }
.qn-chips.is-row .qn-opt { flex: 0 0 auto; white-space: nowrap; scroll-snap-align: start; }

/* v1060 My Notes editor: a taller sheet with the note itself taking the room (Show on and Disappears below it), the
   format bar under the text and held at the bottom of the view while you write, and a typewriter caret - the note's
   colour, an underscore where the phone supports caret shapes. */
.sheet.qn-editor { height: 94%; max-height: 94%; }
.qn-ed-rt { display: flex; flex-direction: column; }
.qn-ed-rt .qn-rt-box { min-height: 38vh; max-height: none; overflow: visible; padding: 10px 2px 18vh; font-size: 0.98rem; line-height: 1.6; }
/* the 18vh under the text is paper for typewriter scrolling: the last line can still rise to its typing point */
.qn-rt-box { position: relative; min-height: 120px; max-height: 380px; overflow-y: auto; padding: 10px 2px 6px;
  outline: none; color: var(--text); font-size: 0.92rem; line-height: 1.55; word-break: break-word;
  -webkit-user-select: text; user-select: text; caret-color: var(--qn-caret, var(--qn, #f59e0b));
  caret-shape: underscore; }

.qn-rt > .qn-rt-bar { margin-top: 6px; }
.qn-ed-rt > .qn-rt-bar { position: sticky; bottom: 0; z-index: 2; background: color-mix(in srgb, var(--qn-bg, var(--card)) 88%, var(--bg-2)); box-shadow: 0 -8px 14px -10px rgba(0, 0, 0, 0.45); }
.qn-rt-haptic svg { width: 17px; height: 17px; }

/* v1063 My Notes: brick layout (two columns, three when wide; cards drop into the shorter column), roomier rows in a
   card's checklist, a note opening in the middle from its card, and emoji for titles. */
.qn-grid.qn-brick { column-count: auto; display: flex; align-items: flex-start; gap: 12px; }
.qn-brick > .qn-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.qn-brick .qn-card { margin: 0; }
.qn-grid.is-list .qn-card { margin-bottom: 12px; }
.qn-sec { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin: 14px 2px 10px; }
.qn-card { position: relative; display: block; break-inside: avoid; margin: 0 0 10px; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--qn) 35%, var(--line)); background: var(--qn-bg); color: var(--text);
  cursor: pointer; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04); transition: transform 0.15s ease, box-shadow 0.2s ease;
  animation: qnIn 0.28s ease both; padding: 14px 14px 12px; }
.qn-list { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.qn-li { display: flex; align-items: flex-start; gap: 7px; font-size: 0.8rem; line-height: 1.4; }
.qn-li-more, .qn-li-done { font-size: 0.68rem; font-weight: 700; color: var(--muted); padding-left: 24px;
  margin-top: 2px; }
.qn-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 12px; }

.qn-float.is-from-card .qn-float-hint { animation: qnFade 0.4s 0.25s ease both; }
.qn-float.is-closing .qn-float-hint { opacity: 0; transition: opacity 0.15s ease; }
.qn-title-row { display: flex; align-items: center; gap: 6px; }
.qn-title-row > input { flex: 1 1 auto; min-width: 0; }
.qn-emoji-btn { flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent; font-size: 1.15rem; line-height: 1; cursor: pointer; filter: grayscale(0.6); opacity: 0.8; transition: filter 0.2s ease, opacity 0.2s ease, background 0.2s ease; }
.qn-emoji-btn:hover, .qn-emoji-btn.is-on { filter: none; opacity: 1; background: color-mix(in srgb, var(--qn, var(--accent)) 18%, transparent); }
.qn-emoji-tray { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 6px 2px 4px; overscroll-behavior-x: contain; }
.qn-emoji-tray.hidden { display: none; }
.qn-emoji-tray::-webkit-scrollbar { display: none; }
.qn-emoji { flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: 12px; background: color-mix(in srgb, var(--text) 5%, transparent); font-size: 1.25rem; line-height: 1; cursor: pointer; }
.qn-emoji:active { transform: scale(0.9); }
.qn-emoji-btn:focus-visible, .qn-emoji:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* v1063: reorder a checklist in the opened note - hold a row 2 seconds (it slowly tints while you hold), then drag;
   the dragged row lifts and the others slide. */

.qn-list.is-sorting { -webkit-user-select: none; user-select: none; }
/* v1063: the note editor's options at the bottom - Show on and Disappears as two pills (their choices open just
   above them), the saved note's Duplicate / Copy text / Share / Delete in one sideways row, then Save / Cancel. */
.sheet.has-fixed-footer .sheet-footer.qn-ed-foot { padding-top: 10px; display: flex; flex-direction: column; gap: 8px; background: color-mix(in srgb, var(--qn-bg, var(--bg-2)) 70%, var(--bg-2)); }
.qn-bot-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qn-bot-pill { min-width: 0; display: flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.qn-bot-pill.is-open { border-color: color-mix(in srgb, var(--qn, var(--accent)) 60%, var(--line)); }
.qn-bot-k { flex: 0 0 auto; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.qn-bot-now { flex: 1; min-width: 0; font-size: 0.76rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.qn-bot-chev { flex: 0 0 auto; color: var(--muted); transform: rotate(-90deg); transition: transform 0.2s ease; }
.qn-bot-pill.is-open .qn-bot-chev { transform: rotate(90deg); }
.qn-bot-panel { max-height: 34vh; overflow-y: auto; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); animation: qnFade 0.2s ease both; }
.qn-bot-panel.hidden { display: none; }
.qn-ed-actions.is-bottom { margin: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.qn-ed-actions.is-bottom::-webkit-scrollbar { display: none; }
.qn-ed-actions.is-bottom .qn-act { flex: 0 0 auto; white-space: nowrap; }
/* v1063: the typewriter carriage - a drawn caret that sweeps back to the start of a new line, a soft trail behind it. */

.qn-rt-carriage { position: absolute; left: 0; top: 0; width: 2px; height: 1.2em; border-radius: 1px; pointer-events: none; opacity: 0; will-change: transform;
  background: var(--qn-caret, var(--qn, #f59e0b)); box-shadow: 10px 0 14px -3px var(--qn-caret, var(--qn, #f59e0b)), 0 0 6px var(--qn-caret, var(--qn, #f59e0b)); }
.qn-rt-sound svg { width: 17px; height: 17px; }
.qn-rt-carriage.is-underscore { width: 10px; }

/* v1064: no empty gap at the bottom of the note editor - the sheet's scroll area is a column and the writing area grows
   to fill whatever height is left, so the format bar always sits right above the bottom options. */
.sheet.qn-editor > .sheet-scroll { display: flex; flex-direction: column; }
.sheet.qn-editor .qn-ed-body { flex: 1 0 auto; display: flex; flex-direction: column; }
.sheet.qn-editor .qn-ed-body > .qn-ed-rt { flex: 1 0 auto; }
.sheet.qn-editor .qn-ed-rt > .qn-rt-box { flex: 1 0 auto; }
.sheet.qn-editor .qn-ed-stamp { flex: 0 0 auto; }

/* ===== v1068 Note styles after the owner's reference: Sticky Note, Notebook, Category Accent =====
   Real paper in every theme (the dimmed, blurred list behind is the dark part): a fibred paper texture, a handwriting
   face the phone already has (Android 'casual' = Coming Soon, iPhone Noteworthy / Bradley Hand, Windows Segoe Print),
   line icons. Each note picks its own style. */
.qn-sn { --hand: var(--note-font);
  --ink: #23202f; --soft: #5f5b6e; --sep: rgba(35, 32, 47, 0.13); --cbc: #6a4fbf; --paper: #fbf3d5;
  --text: var(--ink); --muted: var(--soft); --line: var(--sep); --card: rgba(0, 0, 0, 0.04); --card-2: rgba(0, 0, 0, 0.06);
  position: relative; display: flex; flex-direction: column; color: var(--ink); text-align: left; cursor: default; font-family: var(--hand); font-size: calc(1rem * var(--nfs, 1) * var(--nfx, 1));
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
  filter: drop-shadow(0 22px 26px rgba(0, 0, 0, 0.42)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18)); }
.qn-sn > * { position: relative; }
.qn-sn > .qn-sn-paper { position: absolute; inset: 0; z-index: 0; border-radius: 26px; background-color: var(--paper); background-image: none; }
.qn-sn-head { display: flex; align-items: center; gap: 12px; padding: 30px 14px 6px 24px; z-index: 1; }
.qn-sn-title { flex: 1; min-width: 0; font-size: 1.8em; line-height: 1.18; word-break: normal; overflow-wrap: break-word; }
.qn-sn-title > span { padding: 0 2px 0.2em; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 24' preserveAspectRatio='none'%3E%3Cpath d='M3 15 C 40 9, 110 7, 197 12' fill='none' stroke='%23f07a86' stroke-width='7' stroke-linecap='round' opacity='.9'/%3E%3Cpath d='M14 18 C 60 13, 120 12, 185 15' fill='none' stroke='%23f07a86' stroke-width='3' stroke-linecap='round' opacity='.55'/%3E%3C/svg%3E") no-repeat 0 100% / 100% 0.42em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.qn-sn-acts { flex: 0 0 auto; display: flex; gap: 2px; align-self: flex-start; margin-top: 2px; }
.qn-sn-btn { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; }
.qn-sn-btn svg { width: 26px; height: 26px; }
.qn-sn-btn:hover { background: rgba(0, 0, 0, 0.06); }
.qn-sn-btn:focus-visible, .qn-sn:focus-visible { outline: 2px solid var(--cbc); outline-offset: 2px; }
.qn-sn-pin.is-on svg path { fill: currentColor; }
.qn-sn-body { padding: 10px 24px 2px; z-index: 1; }
.qn-sn .qn-text { display: block; -webkit-line-clamp: unset; overflow: visible; font-family: var(--hand); font-size: 1.1em; line-height: 1.5; color: var(--ink); }
.qn-sn .qn-text b { font-weight: 700; }
.qn-sn .qn-list { gap: 20px; }
.qn-sn .qn-li { gap: 16px; font-family: var(--hand); font-size: 1.08em; line-height: 1.4; color: var(--ink); align-items: flex-start; }
.qn-sn .qn-li.is-done .qn-li-t { color: var(--soft); }
.qn-sn .qn-cb { width: calc(26px * var(--nfs, 1)); height: calc(26px * var(--nfs, 1)); margin-top: 2px; border-radius: 8px; border: 2.6px solid var(--cbc); background: transparent; }
.qn-sn .qn-cb.is-on { background: var(--cbc); border-color: var(--cbc); }
.qn-sn .qn-cb.is-on::after { left: 8px; top: 3px; width: 6px; height: 12px; border-width: 0 3px 3px 0; }
.qn-sn .qn-list > .qn-prog { display: none; }
.qn-sn .qn-li-a { font-family: inherit; font-size: 0.86em; color: var(--soft); }
.qn-sn .qn-li-sep, .qn-sn .qn-li-more, .qn-sn .qn-li-done, .qn-sn .qn-li-sum { font-family: var(--hand); font-size: 0.88em; color: var(--soft); letter-spacing: 0; text-transform: none; }
.qn-sn-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 24px 0; padding: 16px 0 24px; border-top: 1.5px solid var(--sep); z-index: 1; }
.qn-sn-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px 6px 12px; border-radius: 999px; font-size: 1.04em; }
.qn-sn-pill b { font-weight: 700; font-variant-numeric: tabular-nums; }
.qn-sn-pill-ico svg { display: block; width: 24px; height: 24px; }
.qn-sn-meta { display: flex; align-items: center; gap: 10px; }

.qn-sn-exp { font-size: 0.82em; color: var(--soft); }
.qn-sn-skel { height: 12px; margin: 14px 0; border-radius: 6px; background: rgba(35, 32, 47, 0.12); }
.qn-sn-skel.is-short { width: 58%; }

/* Sticky Note: pastel paper, washi tape, a curled corner, a slight tilt */
/* Not tilted (v1069): all three styles keep exactly the same width; the tape keeps its angle. */

  
  
.qn-sn.is-sticky > .qn-sn-paper { border-radius: 30px 30px 26px 30px; background-image: linear-gradient(178deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 40%, rgba(120, 80, 0, 0.05));
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 62px), calc(100% - 62px) 100%, 0 100%); }
.qn-sn-tape { position: absolute; z-index: 2; top: -20px; left: 28%; width: 132px; height: 40px; transform: rotate(-4deg);
  background: repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.14) 0 6px, rgba(255, 255, 255, 0) 6px 14px), var(--tape, rgba(206, 58, 66, 0.86));
  clip-path: polygon(0 6%, 4% 0, 8% 7%, 12% 1%, 88% 0, 92% 6%, 96% 0, 100% 8%, 100% 94%, 96% 100%, 92% 93%, 88% 100%, 12% 99%, 8% 93%, 4% 100%, 0 92%); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.12); }
.qn-sn-curl { position: absolute; right: 0; bottom: 0; z-index: 2; width: 62px; height: 62px; border-radius: 0 0 0 0;
  background: linear-gradient(315deg, rgba(255, 255, 255, 0) 47%, rgba(0, 0, 0, 0.12) 50%, color-mix(in srgb, var(--paper) 70%, #fff) 54%, color-mix(in srgb, var(--paper) 88%, #000) 100%);
  clip-path: polygon(0 0, 100% 0, 0 100%); filter: drop-shadow(-3px -3px 4px rgba(0, 0, 0, 0.12)); }
.qn-sn.is-sticky .qn-sn-foot { border-top: 0; margin-right: 74px; }
.qn-sn.is-sticky .qn-sn-pill { border: 2.4px solid var(--cbc); color: var(--cbc); }
.qn-sn.is-sticky .qn-sn-when { font-style: italic; color: var(--cbc); }

/* Notebook: ruled paper under six spiral rings, a red margin line, a heart for the pin */

.qn-sn-rings { position: absolute; z-index: 2; top: -36px; left: 9%; right: 9%; height: 76px; display: flex; justify-content: space-between; pointer-events: none; }
.qn-sn-rings > i { width: 30px; height: 76px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 76'%3E%3Cdefs%3E%3ClinearGradient id='c' gradientUnits='userSpaceOnUse' x1='6' y1='0' x2='25' y2='0'%3E%3Cstop offset='0' stop-color='%236b717b'/%3E%3Cstop offset='.2' stop-color='%23fbfcfd'/%3E%3Cstop offset='.42' stop-color='%23bcc2cb'/%3E%3Cstop offset='.72' stop-color='%237d838d'/%3E%3Cstop offset='1' stop-color='%23454a53'/%3E%3C/linearGradient%3E%3CradialGradient id='h' cx='.5' cy='.35' r='.7'%3E%3Cstop offset='0' stop-color='%2305060a'/%3E%3Cstop offset='.7' stop-color='%231d2027'/%3E%3Cstop offset='1' stop-color='%23444853'/%3E%3C/radialGradient%3E%3Cfilter id='b' x='-60%25' y='-30%25' width='220%25' height='160%25'%3E%3CfeGaussianBlur stdDeviation='1.5'/%3E%3C/filter%3E%3C/defs%3E%3Cellipse cx='15' cy='59' rx='10' ry='6.6' fill='url%28%23h%29'/%3E%3Cpath d='M6.2 61.6 Q15 68.4 23.8 61.6' fill='none' stroke='%23fff' stroke-opacity='.3' stroke-width='1.2' stroke-linecap='round'/%3E%3Cpath d='M10.5 59 L10.5 23 C10.5 8 22.5 8 22.5 23 L22.5 36' fill='none' stroke='%23000' stroke-opacity='.4' stroke-width='6' filter='url%28%23b%29' transform='translate%282.6 3.2%29'/%3E%3Cpath d='M10.5 58.5 L10.5 23 C10.5 8 22.5 8 22.5 23 L22.5 36' fill='none' stroke='%23353a42' stroke-width='7.2' stroke-linejoin='round'/%3E%3Ccircle cx='10.5' cy='58.5' r='3.6' fill='%23353a42'/%3E%3Cpath d='M10.5 58.5 L10.5 23 C10.5 8 22.5 8 22.5 23 L22.5 36' fill='none' stroke='url%28%23c%29' stroke-width='5.4' stroke-linejoin='round'/%3E%3Ccircle cx='10.5' cy='58.5' r='2.7' fill='url%28%23c%29'/%3E%3Cpath d='M9.2 53 L9.2 23.5 C9.2 14.5 13.2 10.4 16.6 9.9' fill='none' stroke='%23fff' stroke-opacity='.92' stroke-width='1.2' stroke-linecap='round'/%3E%3Cpath d='M12.6 53 L12.6 24' fill='none' stroke='%23fff' stroke-opacity='.25' stroke-width='.9' stroke-linecap='round'/%3E%3Cpath d='M13.4 12.4 C16 10.6 19.4 11.4 20.6 14.6' fill='none' stroke='%23fff' stroke-opacity='.4' stroke-width='.9' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)); }
.qn-sn.is-notebook .qn-sn-head { padding-left: 40px; padding-bottom: 0; align-items: flex-start;
  padding-top: calc(var(--rule) * 1.5); }

.qn-sn.is-notebook .qn-sn-pin { color: #e8505f; }

.qn-sn.is-notebook .qn-sn-when { font-size: 0.86em; }

/* Category Accent: the header in the category's colour, soft hills, the icon badge, the title in bold */
.qn-sn.cat-note { --cat: #34d399; --cat-ink: #047857; } .qn-sn.cat-personal { --cat: #34d399; --cat-ink: #059669; }
.qn-sn.cat-work { --cat: #60a5fa; --cat-ink: #1d4ed8; } .qn-sn.cat-travel { --cat: #a78bfa; --cat-ink: #6d28d9; }
.qn-sn.cat-health { --cat: #2dd4bf; --cat-ink: #0f766e; } .qn-sn.cat-finance { --cat: #4ade80; --cat-ink: #15803d; }
.qn-sn.cat-ideas { --cat: #facc15; --cat-ink: #a16207; } .qn-sn.cat-general { --cat: #94a3b8; --cat-ink: #475569; }
.qn-sn.is-accent { --paper: #fbfaf5; --cbc: var(--cat-ink); }
.qn-sn.is-accent.cat-note, .qn-sn.is-accent.cat-personal { --cbc: #2f9a61; }
.qn-sn.is-accent > .qn-sn-paper { border-radius: 28px; }

.qn-sn.is-accent .qn-sn-head::before, .qn-sn.is-accent .qn-sn-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 48px; pointer-events: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 60' preserveAspectRatio='none'%3E%3Cpath d='M0 38 C 60 10, 120 12, 180 30 S 300 14, 400 26 V60 H0z' fill='%23000'/%3E%3C/svg%3E") no-repeat 0 100% / 100% 100%; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 60' preserveAspectRatio='none'%3E%3Cpath d='M0 38 C 60 10, 120 12, 180 30 S 300 14, 400 26 V60 H0z' fill='%23000'/%3E%3C/svg%3E") no-repeat 0 100% / 100% 100%; background: color-mix(in srgb, var(--cat) 46%, #fff); }
.qn-sn.is-accent .qn-sn-head::after { height: 40px; -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 60' preserveAspectRatio='none'%3E%3Cpath d='M0 50 C 70 36, 130 30, 210 42 S 330 30, 400 40 V60 H0z' fill='%23000'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 60' preserveAspectRatio='none'%3E%3Cpath d='M0 50 C 70 36, 130 30, 210 42 S 330 30, 400 40 V60 H0z' fill='%23000'/%3E%3C/svg%3E"); background: linear-gradient(90deg, color-mix(in srgb, var(--cat) 62%, #fff), color-mix(in srgb, var(--cat) 52%, #fff)); }
.qn-sn.is-accent .qn-sn-head > * { position: relative; z-index: 1; }
.qn-sn.is-accent .qn-sn-title { font-weight: 800; font-size: 1.6em; }
.qn-sn.is-accent .qn-sn-title > span { background: none; padding: 0; }

.qn-sn.is-accent .qn-sn-body { margin-top: -18px; padding-top: 24px; border-radius: 24px 24px 0 0;
  background: var(--paper); z-index: 2; background-color: var(--paper); background-image: var(--tex);
  background-size: var(--tex-size) var(--tex-size); background-blend-mode: multiply; }
.qn-sn.is-accent .qn-sn-foot { z-index: 2; }

.qn-sn.is-accent .qn-sn-when { font-size: 0.86em; }

/* Opening: scale and fade (or grown out of the tapped card); each note in its own slot's style. */
.qn-float .qn-fl.st-accent, .qn-float .qn-fl.st-notebook, .qn-float .qn-fl.st-sticky { --rot: 0deg; filter: none; animation-name: qnSnIn; animation-duration: 0.34s; animation-timing-function: cubic-bezier(.2, .85, .25, 1); }
@keyframes qnSnIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
.qn-float.is-from-card .qn-fl { animation: none; }
.qn-float .qn-float-list { gap: 30px; }
@media (max-width: 380px) { .qn-sn-title { font-size: 1.6em; } .qn-sn .qn-li { font-size: 1.02em; } .qn-sn-body, .qn-sn-head { padding-left: 18px; } }
@media (prefers-reduced-motion: reduce) { .qn-float .qn-fl { animation: none !important; } }

/* In-place editing (double-tap) on the same paper as the note's style. */

.qn-float .st-accent .qn-card.is-editing { background-color: #fbfaf5; }

.qn-float .st-accent .qn-card::after, .qn-float .st-notebook .qn-card::after { display: none; }

/* The editor's own style choice: three small cards under the top row */
.qn-ed-styles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: -2px 0 12px; }
.qn-ed-styles.hidden { display: none; }
.qn-ed-style { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); font: inherit; cursor: pointer; }
.qn-ed-style.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.qn-ed-style-name { font-size: 0.7rem; font-weight: 800; }
.qn-ed-style-art { position: relative; width: 56px; height: 44px; border-radius: 9px; overflow: visible; }
.qn-ed-style.is-sticky .qn-ed-style-art { background: #fbe39a; transform: rotate(-3deg); }
.qn-ed-style.is-sticky .qn-ed-style-art > i:first-child { position: absolute; top: -5px; left: 16px; width: 24px; height: 9px; background: rgba(168, 138, 232, 0.85); transform: rotate(-4deg); }
.qn-ed-style.is-notebook .qn-ed-style-art { background: #fbf7ef repeating-linear-gradient(to bottom, transparent 0 9px, rgba(130, 150, 190, 0.35) 9px 10px); border-left: 2px solid rgba(236, 120, 132, 0.7); }
.qn-ed-style.is-notebook .qn-ed-style-art > i { position: absolute; top: -5px; width: 4px; height: 10px; border-radius: 2px; background: #8b919b; }
.qn-ed-style.is-notebook .qn-ed-style-art > i:nth-child(1) { left: 12px; } .qn-ed-style.is-notebook .qn-ed-style-art > i:nth-child(2) { left: 26px; } .qn-ed-style.is-notebook .qn-ed-style-art > i:nth-child(3) { left: 40px; }
.qn-ed-style.is-accent .qn-ed-style-art { background: linear-gradient(180deg, #b6ecd0 0 42%, #fbfaf5 42%); }
.qn-ed-style.is-accent .qn-ed-style-art > i:first-child { position: absolute; top: 5px; left: 6px; width: 12px; height: 12px; border-radius: 4px; background: #3fb57a; }
.qn-style-pick.is-on { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* The style picker: each style drawn small with the latest note, the chosen one ringed. */
.qn-style-btn { font-size: 1.05rem; }
.qn-style-grid { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 4px; }
.qn-style-opt { display: flex; align-items: center; gap: 14px; padding: 10px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.qn-style-opt.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.qn-style-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qn-style-prev { flex: 0 0 auto; width: 132px; height: 156px; overflow: hidden; border-radius: 14px; pointer-events: none; background: color-mix(in srgb, var(--bg) 70%, #000); padding: 8px; box-sizing: border-box; }
.qn-style-prev > .qn-sn { width: 290px; transform: scale(0.4); transform-origin: 0 0; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.6); }
.qn-style-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.qn-style-txt b { font-size: 0.95rem; }
.qn-style-txt span { font-size: 0.76rem; color: var(--muted); line-height: 1.4; }
html[data-theme="light"] .qn-style-prev { background: #eef1f6; }

/* ===== v1069: tape colour by note, list cards in their own style (a miniature of the opened note), chrome rings ===== */
/* Washi tape and the accent that goes with it, darker than the note's own paper: white = red, yellow = dark yellow... */
.qn-sn.is-sticky { margin-top: 14px; --tape: rgba(206, 58, 66, 0.86); --cbc: #b8343c; }
.qn-sn.is-sticky.qn-c-plain { --paper: #fffcf3; }
.qn-sn.is-sticky.qn-c-sun { --paper: #fbe39a; --tape: rgba(178, 122, 4, 0.88); --cbc: #8a5a06; }
.qn-sn.is-sticky.qn-c-mint { --paper: #c8efd9; --tape: rgba(28, 112, 74, 0.86); --cbc: #1f6a49; }
.qn-sn.is-sticky.qn-c-sky { --paper: #cde8fb; --tape: rgba(30, 86, 156, 0.86); --cbc: #24598f; }
.qn-sn.is-sticky.qn-c-rose { --paper: #fbd2dc; --tape: rgba(176, 28, 80, 0.86); --cbc: #a82f55; }
.qn-sn.is-sticky.qn-c-lilac { --paper: #e4d8fb; --tape: rgba(98, 60, 178, 0.86); --cbc: #6a4fbf; }
.qn-sn.is-sticky.qn-c-peach { --paper: #fdd8bd; --tape: rgba(196, 86, 30, 0.88); --cbc: #a8481f; }

/* The My Notes list: each note a miniature (zoom) of its opened look - the same paper, tape, rings, hills. */
.qn-sn.is-compact { zoom: 0.6; cursor: pointer; filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.26)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.18)); transition: transform 0.15s ease; animation: qnIn 0.28s ease both; }
.qn-sn.is-compact:active { transform: scale(0.985); }
.qn-sn.is-compact.is-expired { opacity: 0.6; filter: grayscale(0.55) drop-shadow(0 6px 8px rgba(0, 0, 0, 0.2)); }
.qn-sn.is-compact .qn-sn-title { font-size: 1.45em; }
/* v1073: list-card text sized like the reference - a title and a short line fit on one line of a half-width card. */
.qn-sn.is-compact .qn-text, .qn-sn.is-compact .qn-li { font-size: 0.98em; }
.qn-sn.is-compact .qn-sn-btn { width: 54px; height: 54px; margin: -6px -6px -6px 0; }
.qn-sn.is-compact .qn-sn-btn svg { width: 28px; height: 28px; }
.qn-sn.is-compact .qn-sn-body { padding-top: 6px; }
.qn-sn.is-compact .qn-text { display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
.qn-sn.is-compact .qn-list { gap: 16px; }
.qn-sn.is-compact .qn-sn-foot { flex-wrap: wrap; margin-top: 8px; padding-top: 14px; padding-bottom: 20px; row-gap: 10px; }
.qn-sn-chips { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 8px; }

.qn-sn.is-compact .qn-sn-when { font-size: 0.92em; }
.qn-grid.is-list { column-count: 1 !important; display: flex; flex-direction: column; gap: 14px; }
.qn-grid.is-list .qn-sn.is-compact { zoom: 0.82; }
@media (prefers-reduced-motion: reduce) { .qn-sn.is-compact { animation: none; } }

/* ===== v1071 Notes appearance: one font and one text size for every note (Menu > Notes appearance) =====
   Fonts already on the phone only - nothing is downloaded. --nfx evens out how big each face looks at the same size
   (handwriting runs small); --nfs is Small / Medium / Large. Set on <html data-nfont data-nsize>, or on a preview. */
:root, [data-nfont="modern"] { --note-font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; --nfx: 1; }
[data-nfont="hand"] { --note-font: 'Patrick Hand', 'Noteworthy', 'Bradley Hand', 'Segoe Print', 'Chalkboard SE', casual, 'Comic Sans MS', cursive; --nfx: 1.1; }

[data-nfont="classic"] { --note-font: 'Iowan Old Style', 'New York', Georgia, 'Palatino Linotype', 'Book Antiqua', 'Noto Serif', 'Droid Serif', 'Times New Roman', serif; --nfx: 1.03; }
[data-nfont="rounded"] { --note-font: ui-rounded, 'SF Pro Rounded', 'Hiragino Maru Gothic ProN', 'Arial Rounded MT Bold', 'Varela Round', 'Nunito', 'M PLUS Rounded 1c', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --nfx: 1; }
:root, [data-nsize="m"] { --nfs: 1; }
[data-nsize="s"] { --nfs: 0.9; }
[data-nsize="l"] { --nfs: 1.12; }

/* The editor and the in-place edit write in the same face and size. */
.qn-editor .qn-ed-title, .qn-editor .qn-rt-box, .qn-editor .qn-ed-it, .qn-float .qn-in-title, .qn-float .qn-in-rt .qn-rt-box, .qn-float .qn-ed-it { font-family: var(--note-font); }
.qn-editor.qn-ed-st-notebook .qn-ed-title { font-family: var(--note-font); }
.qn-editor .qn-rt-box { font-size: calc(0.98rem * var(--nfs, 1) * var(--nfx, 1)); }
.qn-editor .qn-ed-it { font-size: calc(0.92rem * var(--nfs, 1) * var(--nfx, 1)); }
.qn-editor .qn-ed-title { font-size: calc(1.05rem * var(--nfs, 1) * var(--nfx, 1)); }

/* Paper texture on the Category Accent header too. */

/* Menu > Notes appearance: a live preview on the opened-note backdrop, fonts with the same sample line, sizes, style. */
.qn-appear-prev { margin: 0 -4px 6px; padding: 26px 14px 16px; border-radius: 18px; background: linear-gradient(135deg, #1c2140, #2b2a55 60%, #3b2e6b); overflow: hidden; }
.qn-appear-prev > .qn-sn { zoom: 0.78; max-width: 440px; margin-left: auto; margin-right: auto; }
.qn-appear-sec { margin-top: 16px; }
.qn-appear-sec > .hint { margin: -2px 0 8px; }
.qn-font-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.qn-font-opt { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.qn-font-opt.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.qn-font-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qn-font-head { display: flex; flex-direction: column; gap: 1px; }
.qn-font-head b { font-size: 0.86rem; }
.qn-font-head span { font-size: 0.68rem; color: var(--muted); }
.qn-font-sample { font-family: var(--note-font); font-size: calc(0.98rem * var(--nfx, 1)); line-height: 1.35; overflow-wrap: anywhere; }
.qn-size-seg { max-width: 340px; }

/* ===== v1073 My Notes page after the owner's reference: a deep indigo backdrop with a soft purple glow, dark glass
   controls, white section headings, hand-lettered titles on sticky notes and notebooks, italic times ===== */
html:has(#notesView:not(.hidden)) body { background: radial-gradient(70% 45% at 92% 6%, rgba(139, 92, 246, 0.32), transparent 62%),
  radial-gradient(70% 50% at 0% 100%, rgba(99, 102, 241, 0.24), transparent 62%), linear-gradient(180deg, #151a39 0%, #1b1d45 55%, #231e4e 100%) fixed; }
#notesView { padding-bottom: 96px; --text: #eef1fb; --muted: #aab3cf; --line: rgba(255, 255, 255, 0.13);
  --card: rgba(255, 255, 255, 0.07); --card-2: rgba(255, 255, 255, 0.1); --bg: #161b3a; color: var(--text); }
#notesView .qn-hero { background: radial-gradient(120% 140% at 0% 0%, rgba(251, 191, 36, 0.16), transparent 60%), radial-gradient(120% 140% at 100% 100%, rgba(167, 139, 250, 0.2), transparent 60%), rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.12); }
#notesView .qn-compose, #notesView .qn-search, #notesView .qn-view { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.14); color: var(--text); box-shadow: none; }
#notesView .qn-search::placeholder, #notesView .qn-compose-in span { color: #9aa3c4; }
#notesView .qn-filter { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.16); color: #d6dbf0; }
#notesView .qn-filter b { background: rgba(255, 255, 255, 0.1); color: #d6dbf0; }
#notesView .qn-filter.is-on { background: #8ee6be; border-color: #8ee6be; color: #0d2a1f; }
#notesView .qn-filter.is-on b { background: rgba(13, 42, 31, 0.14); color: #0d2a1f; }
#notesView .qn-sec { display: flex; align-items: center; gap: 8px; margin: 20px 2px 14px; font-size: 1.05rem; font-weight: 800; letter-spacing: 0; text-transform: none; color: #f3f5ff; }
#notesView .qn-sec-ico { width: 20px; height: 20px; color: #c3c9ee; }
#notesView .qn-empty, #notesView .qn-empty p { color: var(--muted); }
/* Titles: hand-lettered on sticky notes and notebooks (the body follows the font in Notes appearance), the brush
   underline on notebooks and white sticky notes; the time in italics. */
.qn-sn.is-sticky .qn-sn-title, .qn-sn.is-notebook .qn-sn-title { font-family: var(--hand-title); font-style: italic; font-weight: 700; }
.qn-sn.is-sticky:not(.qn-c-plain) .qn-sn-title > span { background: none; padding-bottom: 0; }
.qn-sn-when { font-size: 0.9em; color: var(--soft); white-space: nowrap; font-style: italic; }
.qn-sn-chip { border-radius: 999px; line-height: 1.3; color: var(--ink); white-space: nowrap; display: inline-flex;
  align-items: center; gap: 6px; padding: 5px 14px; font-size: 0.9em; background: rgba(35, 32, 47, 0.075); }

/* ===== v1074: Category Accent takes the note's chosen colour (the category's colour only for a plain note) ===== */
.qn-sn.is-accent.qn-c-sun, .qn-editor.qn-ed-st-accent.qn-c-sun { --cat: #f6c343; --cat-ink: #8a5a06; --cbc: #8a5a06; }
.qn-sn.is-accent.qn-c-mint, .qn-editor.qn-ed-st-accent.qn-c-mint { --cat: #34d399; --cat-ink: #047857; --cbc: #2f9a61; }
.qn-sn.is-accent.qn-c-sky, .qn-editor.qn-ed-st-accent.qn-c-sky { --cat: #4cc3f7; --cat-ink: #0369a1; --cbc: #0369a1; }
.qn-sn.is-accent.qn-c-rose, .qn-editor.qn-ed-st-accent.qn-c-rose { --cat: #fb8aa0; --cat-ink: #be123c; --cbc: #be123c; }
.qn-sn.is-accent.qn-c-lilac, .qn-editor.qn-ed-st-accent.qn-c-lilac { --cat: #b49cfb; --cat-ink: #6d28d9; --cbc: #6d28d9; }
.qn-sn.is-accent.qn-c-peach, .qn-editor.qn-ed-st-accent.qn-c-peach { --cat: #fda766; --cat-ink: #c2410c; --cbc: #c2410c; }
.qn-sn-badge { flex: 0 0 auto; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px;
  font-size: 1.5em; color: #fff; box-shadow: 0 6px 12px -6px rgba(0, 0, 0, 0.35);
  background: linear-gradient(160deg, color-mix(in srgb, var(--cat) 82%, #fff), color-mix(in srgb, var(--cat) 78%, var(--cat-ink, #064e3b))); }
.qn-sn-leaf svg { display: block; width: 30px; height: 30px;
  color: color-mix(in srgb, var(--cat-ink, #17402c) 75%, #000); }
.qn-sn.is-accent .qn-sn-pill { background: color-mix(in srgb, var(--cat) 32%, #fff);
  color: color-mix(in srgb, var(--cat-ink, #1d4433) 80%, #000); }
.qn-sn.is-compact.is-accent .qn-sn-chip { background: color-mix(in srgb, var(--cat) 26%, #fff); }

/* The editor's top bar: Text / List and the note's style and pin on one line, the colours on their own row below. */
.qn-ed-top { display: flex; margin-bottom: 10px; flex-direction: column; align-items: stretch;
  justify-content: flex-start; gap: 14px; }
.qn-ed-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.qn-ed-acts { display: flex; align-items: center; gap: 8px; }
.qn-ed-top .qn-type { padding: 3px; border-color: color-mix(in srgb, var(--line) 85%, transparent); background: color-mix(in srgb, var(--text) 6%, transparent); }
.qn-ed-top .qn-type button { padding: 7px 14px; font-size: 0.78rem; }
.qn-tool { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px 0 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); font: inherit; font-size: 0.78rem; font-weight: 800; cursor: pointer; transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease; }
.qn-tool-ico { display: grid; place-items: center; }
.qn-tool-ico svg { width: 19px; height: 19px; }
.qn-tool-chev { font-size: 0.7rem; opacity: 0.7; transition: transform 0.2s ease; }
.qn-tool.is-on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.qn-tool.is-on .qn-tool-chev { transform: rotate(180deg); }
.qn-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qn-pin-tool { width: 38px; padding: 0; justify-content: center; color: var(--muted); }
.qn-pin-tool.is-on { color: #f59e0b; border-color: #f59e0b; background: color-mix(in srgb, #fbbf24 20%, transparent); }
.qn-pin-tool.is-on svg path { fill: currentColor; }
.qn-ed-top .qn-colors { flex-wrap: nowrap; gap: 12px; overflow-x: auto; scrollbar-width: none; padding: 4px 3px; }
.qn-ed-top .qn-colors::-webkit-scrollbar { display: none; }
.qn-ed-top .qn-dot { position: relative; flex: 0 0 auto; width: 32px; height: 32px; border-width: 2px; }
.qn-ed-top .qn-dot.is-on { transform: none; box-shadow: 0 0 0 2.5px var(--ed-paper, var(--bg-2)), 0 0 0 4.5px var(--qn); }
.qn-ed-top .qn-dot.is-on::after { content: ''; position: absolute; left: 50%; top: 46%; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translate(-50%, -50%) rotate(45deg); }
.qn-ed-top .qn-dot.qn-c-plain.is-on::after { border-color: var(--text); }
.qn-ed-top .qn-dot.qn-c-plain.is-on { box-shadow: 0 0 0 2.5px var(--ed-paper, var(--bg-2)), 0 0 0 4.5px var(--text); }

/* ===== v1076 Two papers, and only two, across the whole notes experience =====
   Fine Art Paper (icons/paper-fineart.webp) - Sticky Note and Category Accent; Clean Notebook Paper
   (icons/paper-notebook.webp) - Notebook. Both made by tools/paper-texture.py, multiplied over each style's own paper
   colour. The same --tex carries the paper through the list card, the opened note, the double-tap edit and the editor
   (create, edit, checklists), always light paper with dark ink - the dimmed screen behind is the dark part. The
   notebook's ruling and margin are separate layers over its paper. */
:root { --hand-title: 'Patrick Hand', 'Noteworthy', 'Bradley Hand', 'Segoe Print', 'Chalkboard SE', casual, 'Comic Sans MS', cursive; --tex-fineart: url(icons/paper-fineart.webp); --tex-notebook: url(icons/paper-notebook.webp); --tex-size: 192px; }
.qn-sn.is-sticky, .qn-sn.is-accent, .qn-editor.qn-ed-st-sticky, .qn-editor.qn-ed-st-accent, .qn-fl.st-sticky, .qn-fl.st-accent { --tex: var(--tex-fineart); }
.qn-sn.is-notebook, .qn-editor.qn-ed-st-notebook, .qn-fl.st-notebook { --tex: var(--tex-notebook); }
/* The sticky note's paper colour, one value for the card, the opened note and the editor. */
.qn-c-plain { --qn: #94a3b8; --qn-bg: var(--card); --qn-paper: #eef2f7; --qn-paper2: #d5dde8; --qn-caret: #f59e0b;
  --sticky-paper: #fffcf3; } .qn-c-sun { --qn: #f59e0b; --qn-bg: color-mix(in srgb, #fbbf24 20%, var(--card)); --qn-paper: #fde68a;
  --qn-paper2: #f8cf4a; --sticky-paper: #fbe39a; } .qn-c-mint { --qn: #10b981; --qn-bg: color-mix(in srgb, #34d399 18%, var(--card)); --qn-paper: #a7f3d0;
  --qn-paper2: #6ee7b7; --sticky-paper: #c8efd9; } .qn-c-sky { --qn: #0ea5e9; --qn-bg: color-mix(in srgb, #38bdf8 18%, var(--card)); --qn-paper: #bae6fd;
  --qn-paper2: #7dd3fc; --sticky-paper: #cde8fb; }
.qn-c-rose { --qn: #f43f5e; --qn-bg: color-mix(in srgb, #fb7185 18%, var(--card)); --qn-paper: #fecdd3;
  --qn-paper2: #fda4af; --sticky-paper: #fbd2dc; } .qn-c-lilac { --qn: #8b5cf6; --qn-bg: color-mix(in srgb, #a78bfa 20%, var(--card)); --qn-paper: #ddd6fe;
  --qn-paper2: #c4b5fd; --sticky-paper: #e4d8fb; } .qn-c-peach { --qn: #f97316; --qn-bg: color-mix(in srgb, #fdba74 22%, var(--card)); --qn-paper: #fed7aa;
  --qn-paper2: #fdba74; --sticky-paper: #fdd8bd; }

/* The card and the opened note: the paper layer takes the texture; the accent body and header too. */
.qn-sn > .qn-sn-paper::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: var(--tex) repeat 0 0 / var(--tex-size) var(--tex-size); mix-blend-mode: multiply; }
.qn-sn.is-accent .qn-sn-head { padding: 24px 14px 54px 20px; border-radius: 28px 28px 0 0; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--cat) 30%, #fff) 0%, color-mix(in srgb, var(--cat) 22%, #fff) 100%);
  background-image: var(--tex), linear-gradient(180deg, color-mix(in srgb, var(--cat) 30%, #fff) 0%, color-mix(in srgb, var(--cat) 22%, #fff) 100%);
  background-size: var(--tex-size) var(--tex-size), auto; background-blend-mode: multiply, normal; }

/* A list card is the same note at 0.6: the tile is enlarged by the same amount, so the paper looks identical. */
.qn-sn.is-compact > .qn-sn-paper::after { background-size: calc(var(--tex-size) / 0.6) calc(var(--tex-size) / 0.6); }
.qn-sn.is-compact.is-accent .qn-sn-head { background-size: calc(var(--tex-size) / 0.6) calc(var(--tex-size) / 0.6), auto; }
.qn-sn.is-compact.is-accent .qn-sn-body { background-size: calc(var(--tex-size) / 0.6) calc(var(--tex-size) / 0.6); }

/* Double-tap edit: the same paper as the note it came from. */
.qn-float .st-accent .qn-card.is-editing, .qn-float .st-notebook .qn-card.is-editing, .qn-float .st-sticky .qn-card.is-editing { clip-path: none;
  border-radius: 24px; color: #23202f; --text: #23202f; --muted: #5f5b6e; --line: rgba(35, 32, 47, 0.14);
  --card: rgba(255, 255, 255, 0.55); --card-2: rgba(0, 0, 0, 0.06); background-image: var(--tex);
  background-size: var(--tex-size) var(--tex-size); background-blend-mode: multiply; }
.qn-float .st-sticky .qn-card.is-editing { background-color: var(--sticky-paper, var(--qn-paper)); }

/* The editor - creating, editing, checklists: written on the same paper, light with dark ink in both themes. */
.qn-editor.cat-note { --cat: #34d399; --cat-ink: #047857; } .qn-editor.cat-personal { --cat: #34d399; --cat-ink: #059669; }
.qn-editor.cat-work { --cat: #60a5fa; --cat-ink: #1d4ed8; } .qn-editor.cat-travel { --cat: #a78bfa; --cat-ink: #6d28d9; }
.qn-editor.cat-health { --cat: #2dd4bf; --cat-ink: #0f766e; } .qn-editor.cat-finance { --cat: #4ade80; --cat-ink: #15803d; }
.qn-editor.cat-ideas { --cat: #facc15; --cat-ink: #a16207; } .qn-editor.cat-general { --cat: #94a3b8; --cat-ink: #475569; }
.qn-editor.qn-ed-st-sticky { --ed-paper: var(--sticky-paper, #fbe39a); }
.qn-editor.qn-ed-st-notebook { --ed-paper: #fbf7ef; --rule: 32px; --ruled: rgba(70, 110, 175, 0.14); --margin: rgba(214, 84, 84, 0.4); }
.qn-editor.qn-ed-st-accent { --ed-paper: #fbfaf5; }
.qn-editor[class*="qn-ed-st-"] { --text: #23202f; --muted: #5f5b6e; --line: rgba(35, 32, 47, 0.14); --card: rgba(255, 255, 255, 0.55); --card-2: rgba(35, 32, 47, 0.06);
  --bg: var(--ed-paper); --bg-2: var(--ed-paper); color: var(--text);
  background-color: var(--ed-paper); background-image: var(--tex); background-size: var(--tex-size) var(--tex-size); background-blend-mode: multiply; }
.qn-editor.qn-ed-st-sticky .qn-ed-top { margin: -16px -16px 12px; padding: 14px 16px 12px; background-color: color-mix(in srgb, var(--ed-paper) 90%, #000);
  background-image: var(--tex); background-size: var(--tex-size) var(--tex-size); background-blend-mode: multiply; }
.qn-editor.qn-ed-st-accent .qn-ed-top { margin: -16px -16px 12px; padding: 14px 16px 12px; border-bottom: 1px solid color-mix(in srgb, var(--cat) 30%, transparent);
  background-image: var(--tex), linear-gradient(180deg, color-mix(in srgb, var(--cat) 30%, #fff), color-mix(in srgb, var(--cat) 20%, #fff));
  background-size: var(--tex-size) var(--tex-size), auto; background-blend-mode: multiply, normal; }
.qn-editor.qn-ed-st-notebook .qn-ed-top { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.sheet.has-fixed-footer.qn-editor[class*="qn-ed-st-"] .sheet-footer.qn-ed-foot { border-top-color: var(--line); background-color: color-mix(in srgb, var(--ed-paper) 94%, #000);
  background-image: var(--tex); background-size: var(--tex-size) var(--tex-size); background-blend-mode: multiply; }
.qn-editor[class*="qn-ed-st-"] .qn-ed-rt > .qn-rt-bar { background: color-mix(in srgb, var(--ed-paper) 80%, #fff); }
.qn-editor.qn-ed-st-sticky .qn-ed-title, .qn-editor.qn-ed-st-notebook .qn-ed-title { font-family: var(--hand-title); font-style: italic; font-weight: 700; }
.qn-editor.qn-ed-st-accent .qn-rt-box { caret-color: var(--cat-ink); }
.qn-editor.qn-ed-st-notebook .qn-rt-box { caret-color: #2f55a4; }
.qn-editor.qn-ed-st-notebook .qn-ed-rt .qn-rt-box { line-height: var(--rule); padding-left: 46px; padding-top: 0; background-attachment: local;
  background-image: linear-gradient(to right, transparent 34px, var(--margin) 34px, var(--margin) 35.5px, transparent 35.5px),
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--rule) - 1px), var(--ruled) calc(var(--rule) - 1px), var(--ruled) var(--rule)); }
.qn-editor.qn-ed-st-notebook .qn-ed-rt .qn-rt-box * { line-height: var(--rule); margin-top: 0; margin-bottom: 0; }
.qn-editor.qn-ed-st-notebook .qn-ed-rt .qn-rt-box.is-empty::before { left: 46px; }
.qn-editor.qn-ed-st-notebook .qn-ed-list { background-image: linear-gradient(to right, transparent 0, transparent 100%); }

/* ===== v1077 Notebook on one line grid, list and opened alike: --rule is both the ruled-line spacing and the line
   height of everything written on it - the title, every text line, each checklist row and its wrapped lines, the chip
   and the time - so each line of writing sits on its own ruled line, like a real notebook. It follows the note's text
   size (Notes appearance); rem-based, so it is one length everywhere in the card. ===== */

.qn-sn.is-notebook > .qn-sn-paper { border-radius: 24px; background-position: 0 0, 0 0;
  background-image: linear-gradient(to right, transparent 28px, rgba(214, 84, 84, 0.4) 28px, rgba(214, 84, 84, 0.4) 29.5px, transparent 29.5px), repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--rule) - 1px), rgba(70, 110, 175, 0.17) calc(var(--rule) - 1px), rgba(70, 110, 175, 0.17) var(--rule)); }
/* rows: the space under the rings is two rules; then the title; then the writing; then the chip and the time */

.qn-sn.is-notebook .qn-sn-title { line-height: var(--rule); }
.qn-sn.is-notebook .qn-sn-acts { margin-top: 0; height: var(--rule); align-items: center; }
.qn-sn.is-notebook .qn-sn-btn { margin: calc((var(--rule) - 42px) / 2) 0; }
.qn-sn.is-compact.is-notebook .qn-sn-btn { margin: calc((var(--rule) - 54px) / 2) -6px calc((var(--rule) - 54px) / 2) 0; }

.qn-sn.is-notebook .qn-text, .qn-sn.is-notebook .qn-text * { line-height: var(--rule); margin-top: 0; margin-bottom: 0; }
.qn-sn.is-notebook .qn-list { gap: 0; }
.qn-sn.is-notebook .qn-li { min-height: var(--rule); line-height: var(--rule); align-items: flex-start; }
.qn-sn.is-notebook .qn-cb { width: calc(22px * var(--nfs, 1)); height: calc(22px * var(--nfs, 1)); margin-top: calc((var(--rule) - 22px * var(--nfs, 1)) / 2); border-radius: 50%; }
.qn-sn.is-notebook .qn-cb.is-on::after { left: 6.5px; top: 2.5px; width: 5px; height: 10px; }
.qn-sn.is-notebook .qn-li-sep, .qn-sn.is-notebook .qn-li-more, .qn-sn.is-notebook .qn-li-done, .qn-sn.is-notebook .qn-li-sum {
  min-height: var(--rule); line-height: var(--rule); margin: 0; padding-top: 0; padding-bottom: 0; border: 0; background: none; }
.qn-sn.is-notebook .qn-sn-foot { margin-left: 40px; margin-top: 0; padding: 0 0 calc(var(--rule) * 0.6);
  border-top: 0; row-gap: 0; align-items: center; }
.qn-sn.is-notebook .qn-sn-foot > * { min-height: var(--rule); display: flex; align-items: center; }
.qn-sn.is-notebook .qn-sn-chip { padding-top: 0; padding-bottom: 0; line-height: calc(var(--rule) - 8px); }
.qn-sn.is-notebook .qn-sn-pill { background: #e6dafb; color: #4b2d8f; padding-top: 0; padding-bottom: 0;
  height: calc(var(--rule) - 6px); }
/* v1077: like the reference - the title floats a half row above the writing (its own brush underline is its line),
   the writing starts on a rule; smaller chrome rings. */

.qn-sn.is-notebook .qn-sn-body { padding-left: 40px; padding-bottom: 0; padding-top: calc(var(--rule) * 0.5); }
.qn-sn.is-compact.is-notebook .qn-sn-title { font-size: 1.7em; }

/* v1077: the double-tap edit of a notebook writes on rules too - the ruling under the writing box, one line per rule. */
.qn-float .st-notebook .qn-card.is-editing { background-color: #fbf7ef; padding-left: 38px;
  background-image: linear-gradient(to right, transparent 26px, rgba(214, 84, 84, 0.4) 26px, rgba(214, 84, 84, 0.4) 27.5px, transparent 27.5px), var(--tex);
  background-size: auto, var(--tex-size) var(--tex-size); background-blend-mode: normal, multiply; }
.qn-float .st-notebook .qn-card.is-editing .qn-rt-box { line-height: 32px; padding-top: 0; background-attachment: local;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, rgba(70, 110, 175, 0.17) 31px, rgba(70, 110, 175, 0.17) 32px); }
.qn-float .st-notebook .qn-card.is-editing .qn-rt-box * { line-height: 32px; margin-top: 0; margin-bottom: 0; }

/* v1078 Notebook rings after the owner's reference: a satin silver wire loop - the back leg goes behind the page edge,
   the front leg comes down over the paper into a round punched hole (soft light halo, the dark page through it) and
   darkens as it goes in. Proportions measured on the reference: loop as wide as it is high above the edge, thick tube. */
.qn-sn.is-notebook .qn-sn-rings { top: -17px; height: 44px; left: 11%; right: 11%; }
.qn-sn.is-notebook .qn-sn-rings > i { width: 20px; height: 44px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='80 25 130 290'%3E%3Cdefs%3E%3CradialGradient id='h' cx='.46' cy='.4' r='.66'%3E%3Cstop offset='0' stop-color='%23080b22'/%3E%3Cstop offset='.7' stop-color='%2311163a'/%3E%3Cstop offset='1' stop-color='%23262b55'/%3E%3C/radialGradient%3E%3ClinearGradient id='f' gradientUnits='userSpaceOnUse' x1='0' y1='232' x2='0' y2='284'%3E%3Cstop offset='0' stop-color='%230d1130' stop-opacity='0'/%3E%3Cstop offset='1' stop-color='%230d1130' stop-opacity='.92'/%3E%3C/linearGradient%3E%3Cfilter id='s' x='-50%25' y='-50%25' width='200%25' height='200%25'%3E%3CfeGaussianBlur stdDeviation='5'/%3E%3C/filter%3E%3Cfilter id='g' x='-50%25' y='-50%25' width='200%25' height='200%25'%3E%3CfeGaussianBlur stdDeviation='2.8'/%3E%3C/filter%3E%3C/defs%3E%3Cellipse cx='146' cy='256' rx='62' ry='53' fill='%23fff' fill-opacity='.7' filter='url%28%23s%29'/%3E%3Cellipse cx='146' cy='256' rx='54' ry='45' fill='url%28%23h%29'/%3E%3Cpath d='M93 250 A54 45 0 0 1 199 250' fill='none' stroke='%23000' stroke-opacity='.45' stroke-width='5' filter='url%28%23g%29'/%3E%3Cpath d='M174 150 L174 262' stroke='%231b1e33' stroke-opacity='.35' stroke-width='26' stroke-linecap='round' filter='url%28%23s%29'/%3E%3Cpath d='M103 140 L103 82 A32.5 32.5 0 0 1 168 82 L168 268' fill='none' stroke='%235a5e67' stroke-width='30'/%3E%3Cpath d='M103 140 L103 82 A32.5 32.5 0 0 1 168 82 L168 268' fill='none' stroke='%239397a0' stroke-width='23'/%3E%3Cpath d='M103 140 L103 82 A32.5 32.5 0 0 1 168 82 L168 268' fill='none' stroke='%23babdc4' stroke-width='13' transform='translate%283 0%29'/%3E%3Cpath d='M108 140 L108 82 A27.5 27.5 0 0 1 163 82' fill='none' stroke='%23f3f4f6' stroke-opacity='.8' stroke-width='6' stroke-linecap='round' filter='url%28%23g%29'/%3E%3Cpath d='M172 92 L172 250' fill='none' stroke='%23eef0f3' stroke-opacity='.8' stroke-width='6' stroke-linecap='round' filter='url%28%23g%29'/%3E%3Cpath d='M168 226 L168 268' fill='none' stroke='url%28%23f%29' stroke-width='31' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain; filter: none; }
.qn-sn.is-notebook { --paper: #fbf7ef; --cbc: #6b6876; --rule: calc(1.75rem * var(--nfs, 1) * var(--nfx, 1));
  margin-top: 20px; }

/* v1078 Indent: a text line, a list line or a checklist item steps in (data-ind 1-4, two leading spaces per step in
   the note's own text). The same step in the list card, the opened note, the in-place edit and the editor. */
[data-ind="1"] { --ind: 1; } [data-ind="2"] { --ind: 2; } [data-ind="3"] { --ind: 3; } [data-ind="4"] { --ind: 4; }
.qn-rich [data-ind], .qn-li[data-ind] { margin-inline-start: calc(var(--ind) * 1.5em); }
.qn-ed-row[data-ind] { margin-inline-start: calc(var(--ind) * 22px); }
.qn-ed-listbar { width: max-content; max-width: 100%; gap: 4px; margin-top: 6px; }

/* v1079 Reordering a checklist, redone: no tinted block behind the row and no phone tap flash. Holding (1 s) presses
   the row in a touch while a fine ink line draws under its words; then it lifts as a strip of the note's own paper
   with a soft shadow, and the other rows step back while it moves. */
.qn-list.can-sort .qn-li.is-open { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  border-radius: 8px; position: relative; -webkit-tap-highlight-color: transparent; background: none;
  transition: transform 0.18s ease, opacity 0.18s ease, scale 0.2s ease, box-shadow 0.2s ease; }
.qn-list.can-sort .qn-li.is-holding { scale: 0.985; }
.qn-list.can-sort .qn-li.is-holding::after { content: ''; position: absolute; left: 34px; right: 4px; bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--cbc, var(--accent)); opacity: 0.6; transform: scaleX(0); transform-origin: left; animation: qnHold 1s linear forwards; pointer-events: none; }
@keyframes qnHold { to { transform: scaleX(1); } }
.qn-list.can-sort .qn-li.is-dragging { z-index: 3; transition: none; scale: 1.02; border-radius: 10px;
  background-color: var(--paper, var(--card)); background-image: var(--tex, none); background-size: var(--tex-size, 192px) var(--tex-size, 192px); background-blend-mode: multiply;
  box-shadow: 0 0 0 7px var(--paper, var(--card)), 0 14px 26px -10px rgba(35, 32, 47, 0.5), 0 0 0 8px rgba(35, 32, 47, 0.06); }
.qn-list.is-sorting .qn-li.is-open:not(.is-dragging) { opacity: 0.55; }
.qn-sn-badge.has-emoji .qn-sn-emoji { font-size: 1.15em; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18)); }
@media (prefers-reduced-motion: reduce) { .qn-list.can-sort .qn-li.is-holding { scale: none; } .qn-list.can-sort .qn-li.is-holding::after { animation: none; transform: none; opacity: 0.3; } }
