/* Waterflow! A clear, glassy notebook: streams, notebooks, tags, and live Keydown formatting. */
:root {
    --sky1: #d9f9ff; --sky2: #8fe2fa; --sky3: #36cdee;
    --ink: #0b2a44; --mute: #4d6e89; --line: rgba(14, 90, 150, .22);
    --glass: rgba(255, 255, 255, .62); --glass2: rgba(255, 255, 255, .85);
    --aqua1: #6fe0ff; --aqua2: #36cdee; --aqua3: #0a93b2;
    --green: #2fc26a; --orange: #ff8a1b; --red: #e5484d;
    --paper: #ffffff; --paper-ink: #12263a;
    --shadow: 0 10px 30px rgba(8, 70, 130, .22);
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, "JetBrains Mono", Consolas, monospace;
    --doc-w: 780px;
}
body[data-theme="night"] {
    --sky1: #0a2540; --sky2: #0b3a63; --sky3: #0d5ea8;
    --ink: #e6f4ff; --mute: #93b6d3; --line: rgba(120, 200, 255, .22);
    --glass: rgba(9, 32, 56, .62); --glass2: rgba(10, 36, 64, .88);
    --paper: #0f2237; --paper-ink: #e6f4ff;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
body[data-theme="sand"] {
    --sky1: #fff3d9; --sky2: #ffd9a0; --sky3: #ff9f43;
    --ink: #3b2410; --mute: #8a6a4b; --line: rgba(160, 100, 30, .25);
    --aqua1: #ffd08a; --aqua2: #ff9a2e; --aqua3: #d9700a;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 45%, var(--sky3) 90%) fixed; overflow: hidden; -webkit-font-smoothing: antialiased; }
svg:not(.an-ink-layer) { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg:not(.an-ink-layer):not([width]) { width: 18px; height: 18px; }   /* (icons only: a drawing layer or a chart that sets its own size keeps it) */
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
kbd { font: 11px var(--mono); padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--glass2); box-shadow: 0 1px 0 var(--line); }

/* bubbles drifting up behind everything */
.wf-sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.wf-sky i { position: absolute; bottom: -80px; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .95) 0 10%, rgba(255, 255, 255, .15) 40%, rgba(255, 255, 255, .05) 70%); border: 1px solid rgba(255, 255, 255, .6); animation: wf-rise 22s linear infinite; opacity: .7; }
.wf-sky i:nth-child(1) { left: 6%; width: 30px; height: 30px; animation-duration: 19s; }
.wf-sky i:nth-child(2) { left: 18%; width: 64px; height: 64px; animation-duration: 28s; animation-delay: -6s; }
.wf-sky i:nth-child(3) { left: 33%; width: 22px; height: 22px; animation-duration: 17s; animation-delay: -3s; }
.wf-sky i:nth-child(4) { left: 49%; width: 50px; height: 50px; animation-duration: 25s; animation-delay: -12s; }
.wf-sky i:nth-child(5) { left: 63%; width: 36px; height: 36px; animation-duration: 21s; animation-delay: -9s; }
.wf-sky i:nth-child(6) { left: 77%; width: 70px; height: 70px; animation-duration: 31s; animation-delay: -15s; }
.wf-sky i:nth-child(7) { left: 88%; width: 26px; height: 26px; animation-duration: 18s; animation-delay: -1s; }
.wf-sky i:nth-child(8) { left: 95%; width: 44px; height: 44px; animation-duration: 26s; animation-delay: -18s; }
@keyframes wf-rise { to { transform: translateY(-115vh) translateX(40px); } }
body.wf-nobubbles .wf-sky { display: none; }
@media (prefers-reduced-motion: reduce) { .wf-sky i { animation: none; } }

.wf-app { position: relative; z-index: 1; display: grid; grid-template-columns: 232px 320px minmax(0, 1fr) 232px; gap: 12px; height: 100%; padding: 12px; }
body.wf-focus .wf-app { grid-template-columns: 0 0 minmax(0, 1fr) 0; }
body.wf-focus .wf-rail, body.wf-focus .wf-list, body.wf-focus .wf-side { display: none; }
body.wf-noside .wf-app { grid-template-columns: 232px 320px minmax(0, 1fr); }
body.wf-noside .wf-side { display: none; }

.wf-rail, .wf-list, .wf-main, .wf-side { background: var(--glass); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); border: 1px solid rgba(255, 255, 255, .7); border-radius: 20px; box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .8); min-height: 0; }
body[data-theme="night"] .wf-rail, body[data-theme="night"] .wf-list, body[data-theme="night"] .wf-main, body[data-theme="night"] .wf-side { border-color: rgba(120, 200, 255, .25); }

/* ---------- gel buttons ---------- */
.wf-gel { --main: #36cdee; --soft: #d2f7fc; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--main); background: var(--soft); color: color-mix(in srgb, var(--main) 72%, #000); font-weight: 600; }
.wf-gel:hover { background: color-mix(in srgb, var(--soft) 72%, var(--main)); }
.wf-gel:active { transform: translateY(1px); }
.wf-gel.wf-red { --main: #e5484d; --soft: #ffe1e2; }
.wf-ghost { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; }
.wf-ghost:hover { background: rgba(255, 255, 255, .5); }
body[data-theme="night"] .wf-ghost:hover { background: rgba(120, 200, 255, .12); }
.wf-mini { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: 10px; border: 1px solid var(--line); background: var(--glass2); color: var(--ink); }
.wf-mini:hover { border-color: var(--aqua2); color: var(--aqua3); }
.wf-mini.on { background: #d2f7fc; color: #0a93b2; border: 2px solid #36cdee; }
.wf-grow { flex: 1; }
.wf-onlyphone { display: none; }

/* ---------- rail ---------- */
.wf-rail { display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; overflow: auto; }
.wf-brand { display: flex; align-items: center; gap: 10px; padding: 2px 4px 6px; }
.wf-brand img { filter: drop-shadow(0 2px 4px rgba(0, 60, 120, .35)); }
.wf-brand b { display: block; font-size: 17px; letter-spacing: .2px; }
.wf-brand small { display: block; color: var(--mute); font-size: 11px; margin-top: -2px; }
.wf-streams { display: flex; flex-direction: column; gap: 2px; }
.wf-st { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; width: 100%; }
.wf-st:hover { background: rgba(255, 255, 255, .5); }
body[data-theme="night"] .wf-st:hover { background: rgba(120, 200, 255, .12); }
.wf-st.on { background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .6)); box-shadow: 0 1px 4px rgba(8, 70, 130, .2), inset 0 0 0 1px rgba(255, 255, 255, .9); font-weight: 600; }
body[data-theme="night"] .wf-st.on { background: linear-gradient(180deg, rgba(120, 200, 255, .28), rgba(120, 200, 255, .12)); }
.wf-st .wf-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: inset 0 1px 1px rgba(255, 255, 255, .8), 0 0 0 1px rgba(0, 0, 0, .12); }
.wf-st span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-st em { font-style: normal; font-size: 11px; color: var(--mute); }
.wf-sect { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; padding: 0 6px; color: var(--mute); font-size: 11px; text-transform: uppercase; letter-spacing: .9px; font-weight: 700; }
.wf-sect .wf-mini { width: 24px; height: 24px; border-radius: 8px; }
.wf-sect .wf-mini svg { width: 14px; height: 14px; }
.wf-tags { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 4px; }
.wf-tag { border: 1px solid var(--line); border-radius: 999px; background: var(--glass2); padding: 2px 10px; font-size: 12px; color: var(--ink); }
.wf-tag:hover, .wf-tag.on { background: #d2f7fc; color: #0a93b2; border-color: #36cdee; }
.wf-meter { padding: 8px 10px; border-radius: 12px; background: var(--glass2); border: 1px solid var(--line); }
.wf-meter-top { display: flex; justify-content: space-between; font-size: 11px; color: var(--mute); }
.wf-meter-track { height: 10px; margin-top: 5px; border-radius: 999px; background: rgba(0, 60, 120, .15); box-shadow: inset 0 1px 3px rgba(0, 40, 90, .3); overflow: hidden; }
.wf-meter-track i { display: block; height: 100%; width: 3%; border-radius: 999px; background: linear-gradient(180deg, #9ff0ff, #36cdee 55%, #0a93b2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7); transition: width .5s; }
.wf-railbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }

/* ---------- note list ---------- */
.wf-list { display: flex; flex-direction: column; padding: 14px 12px 8px; gap: 10px; }
.wf-listhead { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.wf-listhead h2 { margin: 0; font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-count { color: var(--mute); font-size: 12px; }
.wf-search { display: flex; align-items: center; gap: 6px; padding: 0 6px 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass2); box-shadow: inset 0 1px 3px rgba(0, 60, 120, .12); }
.wf-search svg { width: 16px; height: 16px; color: var(--mute); }
.wf-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; padding: 8px 0; }
.wf-search select { border: 0; background: none; font-size: 12px; color: var(--mute); outline: none; max-width: 78px; }
.wf-cards { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 10px; }
.wf-cardn { position: relative; text-align: left; border: 1px solid rgba(255, 255, 255, .85); border-radius: 14px; padding: 10px 12px 10px 16px; background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .6)); box-shadow: 0 2px 8px rgba(8, 70, 130, .14); color: var(--ink); width: 100%; }
body[data-theme="night"] .wf-cardn { background: linear-gradient(180deg, rgba(20, 56, 92, .9), rgba(12, 40, 68, .7)); border-color: rgba(120, 200, 255, .2); }
.wf-cardn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(8, 70, 130, .22); }
.wf-cardn.on { outline: 2px solid var(--aqua2); }
.wf-cardn::before { content: ""; position: absolute; left: 6px; top: 12px; bottom: 12px; width: 4px; border-radius: 4px; background: var(--c, transparent); }
.wf-cardn b { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.wf-cardn b span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-cardn b svg { width: 13px; height: 13px; color: var(--orange); }
.wf-cardn p { margin: 3px 0 5px; color: var(--mute); font-size: 12.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wf-cardn small { display: flex; gap: 6px; align-items: center; font-size: 11px; color: var(--mute); }
.wf-cardn small i { font-style: normal; padding: 0 7px; border-radius: 999px; background: rgba(54, 205, 238, .16); color: var(--aqua3); }
.wf-none { padding: 24px 10px; text-align: center; color: var(--mute); }

/* ---------- editor ---------- */
.wf-main { position: relative; display: flex; flex-direction: column; overflow: hidden; }
.wf-empty { margin: auto; text-align: center; padding: 30px; max-width: 420px; }
.wf-empty h2 { margin: 14px 0 4px; font-size: 24px; }
.wf-empty p { color: var(--mute); }
.wf-hint { font-size: 12px; margin-top: 18px; }
.wf-drop { position: relative; width: 86px; height: 110px; margin: 0 auto; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; border: 4px solid #36cdee; background: #8fe6f7; box-sizing: border-box; animation: wf-bob 4s ease-in-out infinite; }
.wf-drop::before { content: ""; position: absolute; left: 14px; top: 20px; width: 24px; height: 14px; border-radius: 50%; background: #fff; transform: rotate(-35deg); }
body[data-theme="night"] .wf-drop { background: #12395e; }
@keyframes wf-bob { 50% { transform: translateY(-8px); } }
.wf-legacy { margin-top: 20px; padding: 14px; border-radius: 14px; border: 1px dashed var(--aqua2); background: var(--glass2); font-size: 13px; text-align: left; }
.wf-legacy .wf-gel { margin-top: 8px; padding: 6px 14px; }
.wf-note { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.wf-notehead { display: flex; align-items: center; gap: 8px; padding: 12px 14px 6px; }
.wf-title { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 24px; font-weight: 700; color: var(--ink); padding: 4px 6px; border-radius: 10px; }
.wf-title:focus { background: rgba(255, 255, 255, .5); }
.wf-title::placeholder { color: var(--mute); opacity: .7; }
.wf-modes { display: flex; padding: 3px; border-radius: 999px; background: var(--glass2); border: 1px solid var(--line); }
.wf-modes button { border: 0; background: none; padding: 5px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--aqua3); }
.wf-modes button[aria-selected="true"] { background: #d2f7fc; color: #0a93b2; box-shadow: inset 0 0 0 2px #36cdee; }
.wf-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 2px 18px 8px; }
.wf-nbpick { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass2); color: var(--mute); }
.wf-nbpick svg { width: 14px; height: 14px; }
.wf-nbpick select { border: 0; background: none; outline: none; font-size: 12.5px; max-width: 150px; }
.wf-chips { display: contents; }
.wf-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 999px; background: rgba(54, 205, 238, .18); color: var(--aqua3); font-size: 12px; }
body[data-theme="night"] .wf-chip { color: #9fdcff; }
.wf-chip button { border: 0; background: none; padding: 0 5px; line-height: 1; color: inherit; opacity: .7; }
.wf-taginput { width: 84px; border: 1px dashed var(--line); background: none; border-radius: 999px; padding: 2px 10px; outline: none; font-size: 12px; }
.wf-taginput:focus { border-style: solid; border-color: var(--aqua2); background: var(--glass2); }
.wf-colors { display: inline-flex; gap: 4px; margin-left: auto; }
.wf-colors button { width: 16px; height: 16px; padding: 0; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .2); box-shadow: inset 0 1px 1px rgba(255, 255, 255, .8); }
.wf-colors button.on { outline: 2px solid var(--ink); outline-offset: 1px; }
.wf-tools { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 14px 8px; }
.wf-tools button { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--glass2); font-size: 12.5px; }
.wf-tools button:hover { border-color: var(--aqua2); color: var(--aqua3); }
.wf-tools button svg { width: 14px; height: 14px; }
.wf-tools .wf-b { font-weight: 800; } .wf-tools .wf-i { font-style: italic; font-family: Georgia, serif; } .wf-tools .wf-u { text-decoration: underline; }
.wf-stage { position: relative; flex: 1; min-height: 0; margin: 0 14px; border-radius: 14px; overflow: hidden; }
.wf-pane { position: absolute; inset: 0; overflow: auto; }
.wf-paper { background: var(--paper); color: var(--paper-ink); padding: 26px max(22px, calc((100% - var(--doc-w)) / 2)); border: 1px solid var(--line); border-radius: 14px; outline: none; font-size: 16px; line-height: 1.7; box-shadow: inset 0 2px 8px rgba(0, 60, 120, .08); }
.wf-paper > *:first-child { margin-top: 0; }
body[data-theme="night"] .wf-paper { --kd-ink: #e6f4ff; }
.wf-src { background: #06323d; border: 1px solid #0f6a7d; border-radius: 14px; overflow: hidden; box-shadow: inset 0 2px 12px rgba(0, 20, 30, .45); }
.wf-hl, .wf-src textarea { box-sizing: border-box; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 22px 26px; border: 0; font: 14px/1.65 var(--mono); letter-spacing: 0; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; tab-size: 4; font-variant-ligatures: none; overflow: auto; scrollbar-width: none; }
.wf-hl::-webkit-scrollbar, .wf-src textarea::-webkit-scrollbar { display: none; }
.wf-hl { color: #d4f5fb; pointer-events: none; }
.wf-src textarea { resize: none; background: transparent; color: transparent; -webkit-text-fill-color: transparent; caret-color: #ffa94d; outline: none; }
.wf-src textarea::selection { background: #0f7a90; -webkit-text-fill-color: transparent; }
.wf-src textarea::placeholder { color: #4f93a3; -webkit-text-fill-color: #4f93a3; }
.wf-hl .m-h { color: #2ee6ff; font-weight: 700; } .wf-hl .m-k { color: #ff9b3d; } .wf-hl .m-s { color: #a8f1ff; } .wf-hl .m-n { color: #5aa9ff; } .wf-hl .m-c { color: #4f93a3; }
.wf-hl .m-t { color: #6fe7ff; } .wf-hl .m-p { color: #7cc0ff; } .wf-hl .m-b { color: #ffb066; font-weight: 700; } .wf-hl .m-i { color: #ffb066; font-style: italic; }
.wf-hl .m-l { color: #6fe7ff; text-decoration: underline; } .wf-hl .m-d { color: #4f93a3; }
.wf-hl .m-f { color: #ff9b3d; background: rgba(255, 155, 61, .16); border-radius: 4px; padding: 0 4px; font-style: italic; }
.wf-foot { display: flex; align-items: center; gap: 10px; padding: 8px 20px 12px; font-size: 12px; color: var(--mute); }
.wf-sep { width: 4px; height: 4px; border-radius: 50%; background: var(--mute); opacity: .5; }
.wf-saved::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); }
.wf-saved.busy::before { background: var(--orange); box-shadow: 0 0 6px var(--orange); }

/* ---------- outline ---------- */
.wf-side { padding: 14px 14px; overflow: auto; }
.wf-side h3 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .9px; color: var(--mute); }
.wf-outline { display: flex; flex-direction: column; gap: 1px; margin-bottom: 18px; }
.wf-outline button { text-align: left; border: 0; background: none; padding: 4px 8px; border-radius: 8px; color: var(--ink); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-outline button:hover { background: rgba(255, 255, 255, .5); }
.wf-outline .l2 { padding-left: 18px; } .wf-outline .l3 { padding-left: 30px; } .wf-outline .l4 { padding-left: 42px; }
.wf-outline p, .wf-info dd { color: var(--mute); font-size: 12.5px; margin: 0; }
.wf-info { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 12.5px; }
.wf-info dt { color: var(--mute); } .wf-info dd { color: var(--ink); text-align: right; }

/* ---------- overlays ---------- */
.wf-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: start center; padding: 12vh 12px 12px; background: rgba(4, 40, 80, .35); backdrop-filter: blur(4px); }
.wf-modal#wf-dialog { place-items: center; padding: 12px; }
.wf-card { background: var(--glass2); border: 1px solid rgba(255, 255, 255, .8); border-radius: 18px; box-shadow: var(--shadow); }
body[data-theme="night"] .wf-card { background: #0d2640; border-color: rgba(120, 200, 255, .3); }
.wf-pal { width: min(560px, 100%); overflow: hidden; }
.wf-pal input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 16px 18px; font-size: 17px; outline: none; }
.wf-pallist { max-height: 46vh; overflow: auto; padding: 6px; }
.wf-palrow { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 0; border-radius: 10px; background: none; text-align: left; }
.wf-palrow.on { background: #d2f7fc; color: #0a93b2; box-shadow: inset 0 0 0 2px #36cdee; }
.wf-palrow small { margin-left: auto; opacity: .7; font-size: 11px; }
.wf-dlg { width: min(640px, 100%); max-height: 88vh; display: flex; flex-direction: column; }
.wf-dlg header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 8px; }
.wf-dlg h3 { margin: 0; font-size: 18px; }
.wf-dlg-body { padding: 4px 18px 18px; overflow: auto; }
.wf-dlg-body h4 { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--mute); }
.wf-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; }
.wf-row > span { flex: 1; min-width: 160px; }
.wf-row small { display: block; color: var(--mute); }
.wf-btn { display: inline-block; text-decoration: none; color: inherit; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass2); }
.wf-btn:hover { border-color: var(--aqua2); color: var(--aqua3); }
.wf-btn.danger { color: var(--red); }
.wf-dlg select, .wf-dlg input[type="text"] { padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); }
.wf-switch { appearance: none; width: 40px; height: 22px; border-radius: 999px; background: rgba(0, 60, 120, .25); position: relative; border: 0; transition: background .2s; }
.wf-switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .2s; }
.wf-switch:checked { background: linear-gradient(180deg, var(--aqua1), var(--aqua2)); }
.wf-switch:checked::after { transform: translateX(18px); }
.wf-menu { position: fixed; z-index: 60; min-width: 190px; max-height: 62vh; overflow: auto; padding: 6px; border-radius: 14px; background: var(--glass2); border: 1px solid rgba(255, 255, 255, .8); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
body[data-theme="night"] .wf-menu { background: #0d2640; border-color: rgba(120, 200, 255, .3); }
.wf-menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 9px; text-align: left; }
.wf-menu button:hover { background: rgba(54, 205, 238, .18); }
.wf-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.wf-menu .danger { color: var(--red); }
.wf-toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 70; padding: 9px 18px; border-radius: 999px; background: #d2f7fc; border: 2px solid #36cdee; color: #0a93b2; box-shadow: var(--shadow); font-weight: 600; max-width: 90vw; }

/* ---------- small screens: one pane at a time ---------- */
@media (max-width: 1180px) { .wf-app { grid-template-columns: 220px 300px minmax(0, 1fr); } .wf-side { display: none; } }
@media (max-width: 860px) {
    body { overflow: hidden; }
    .wf-app { display: block; padding: 0; }
    .wf-rail, .wf-list, .wf-main { position: absolute; inset: 0; border-radius: 0; border: 0; }
    .wf-rail { z-index: 5; transform: translateX(-100%); transition: transform .25s; }
    body[data-rail="open"] .wf-rail { transform: none; }
    .wf-list { z-index: 2; }
    .wf-main { z-index: 3; transform: translateX(100%); transition: transform .25s; }
    body[data-view="edit"] .wf-main { transform: none; }
    .wf-onlyphone { display: inline-grid; }
    .wf-title { font-size: 19px; }
    .wf-modes button { padding: 5px 9px; }
    .wf-colors { display: none; }
}

@media print {
    body { background: #fff; overflow: visible; }
    .wf-sky, .wf-rail, .wf-list, .wf-side, .wf-notehead, .wf-meta, .wf-tools, .wf-foot, .wf-modal, .wf-toast { display: none !important; }
    .wf-app, .wf-main, .wf-note, .wf-stage { display: block; position: static; box-shadow: none; border: 0; background: none; backdrop-filter: none; padding: 0; margin: 0; overflow: visible; }
    .wf-pane { position: static; overflow: visible; }
    #wf-visual, #wf-view, #wf-srcwrap { display: none !important; }
    body[data-printing="1"] #wf-view { display: block !important; border: 0; padding: 0; box-shadow: none; }
}

/* ===== POOLSIDE: crisp orange accents on the clear cyan and blue water (life rings, lane ropes, tile edges) ===== */
:root { --or1: #ffb35c; --or2: #ff8a1b; --or3: #d96a00; }
body[data-theme="sand"] { --or1: #7ad3ff; --or2: #36cdee; --or3: #0a93b2; }
body[data-theme="sand"] .wf-new, body[data-theme="sand"] .wf-empty .wf-gel, body[data-theme="sand"] .wf-legacy .wf-gel { --main: #36cdee; --soft: #d2f7fc; }
::selection { background: rgba(255, 138, 27, .35); }
/* the New note button is a life ring: orange gel */
.wf-new { --main: #ff8a1b; --soft: #ffe9d1; }
.wf-new:hover { background: color-mix(in srgb, var(--soft) 72%, var(--main)); }
/* lane ropes: a stripe of orange and white under each panel title */
.wf-listhead::after, .wf-brand::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 5px; border-radius: 4px; background: repeating-linear-gradient(90deg, var(--or2) 0 12px, #fff 12px 24px); box-shadow: 0 1px 2px rgba(0, 60, 120, .25); opacity: .95; }
.wf-listhead, .wf-brand { position: relative; margin-bottom: 8px; }
/* the stream you are in gets an orange tile edge */
.wf-st.on { box-shadow: inset 4px 0 0 var(--or2), 0 1px 4px rgba(8, 70, 130, .2), inset 0 0 0 1px rgba(255, 255, 255, .9); }
.wf-st.on svg { color: var(--or3); }
.wf-st em { color: var(--or3); font-weight: 700; }
body[data-theme="night"] .wf-st em { color: var(--or1); }
.wf-sect { color: var(--or3); }
body[data-theme="night"] .wf-sect { color: var(--or1); }
/* the open note card, pins and the color strip */
.wf-cardn.on { outline: 0; box-shadow: inset 5px 0 0 var(--or2), 0 6px 16px rgba(8, 70, 130, .22); }
.wf-cardn.on::before { display: none; }
.wf-cardn b svg { color: var(--or2); fill: var(--or2); }
.wf-mini.on { background: #ffe9d1; border: 2px solid #ff8a1b; color: #b85500; }
.wf-mini:hover { border-color: var(--or2); color: var(--or3); }
/* tags and chips */
.wf-tag:hover, .wf-tag.on { background: #ffe9d1; border-color: #ff8a1b; color: #b85500; }
.wf-chip { background: rgba(255, 138, 27, .16); color: var(--or3); box-shadow: inset 0 0 0 1px rgba(255, 138, 27, .5); }
body[data-theme="night"] .wf-chip { color: var(--or1); }
/* focus rings and the active insert buttons */
.wf-title:focus { background: rgba(255, 255, 255, .5); box-shadow: 0 2px 0 var(--or2); border-radius: 10px 10px 0 0; }
.wf-taginput:focus, .wf-search:focus-within, .wf-pal input:focus { border-color: var(--or2); }
.wf-search:focus-within { box-shadow: 0 0 0 3px rgba(255, 138, 27, .28), inset 0 1px 3px rgba(0, 60, 120, .12); }
.wf-tools button:hover { border-color: var(--or2); color: var(--or3); }
.wf-colors button.on { outline-color: var(--or2); }
/* the water meter ends in an orange buoy */
.wf-meter-track { position: relative; overflow: visible; }
.wf-meter-track::after { content: ""; position: absolute; right: -2px; top: -3px; width: 6px; height: 16px; border-radius: 3px; background: var(--or2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6); }
.wf-meter-track i { border-radius: 999px; }
/* the quick switcher, toasts and the legacy offer */
.wf-palrow.on { background: #ffe9d1; color: #b85500; box-shadow: inset 0 0 0 2px #ff8a1b; }
.wf-toast { background: #ffe9d1; border-color: #ff8a1b; color: #b85500; }
.wf-legacy { border-color: var(--or2); }
.wf-empty .wf-gel, .wf-legacy .wf-gel { --main: #ff8a1b; --soft: #ffe9d1; }
.wf-outline button:hover { background: rgba(255, 138, 27, .14); }
.wf-dlg-body h4 { color: var(--or3); }
body[data-theme="night"] .wf-dlg-body h4 { color: var(--or1); }
/* a tile-edge stripe along the top of the note paper */
.wf-stage::before { content: ""; position: absolute; left: 14px; right: 14px; top: 0; height: 4px; z-index: 2; border-radius: 0 0 4px 4px; background: repeating-linear-gradient(90deg, var(--or2) 0 14px, transparent 14px 28px); pointer-events: none; }
@media print { .wf-stage::before, .wf-listhead::after, .wf-brand::after { display: none; } }

body[data-theme="night"] .wf-gel { --soft: #12395e; color: #bfe6ff; }
body[data-theme="night"] .wf-new { --soft: #4a2a0c; color: #ffd2a0; }
body[data-theme="night"] .wf-modes button[aria-selected="true"], body[data-theme="night"] .wf-mini.on, body[data-theme="night"] .wf-tag.on, body[data-theme="night"] .wf-tag:hover, body[data-theme="night"] .wf-palrow.on, body[data-theme="night"] .wf-toast { background: #12395e; color: #bfe6ff; }

/* inline code looks like it does in Writeout: a soft slate chip (styled `code`{neon} ones keep their own look) */
.wf-paper :not(pre) > code:not(.kd-ic) { background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%); border: 1px solid #cbd5e1; color: #475569; padding: 3px 6px; border-radius: 5px; font-size: 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); font-family: monospace; }
body[data-theme="night"] .wf-paper :not(pre) > code:not(.kd-ic) { background: linear-gradient(180deg, #24384d, #1b2c3f); border-color: #3b5774; color: #cfe3f5; }

/* ---------- notebook options ---------- */
.wf-st-more { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: -6px; border-radius: 8px; opacity: 0; transition: opacity .15s, background .15s; }
.wf-st-more svg { width: 14px; height: 14px; }
.wf-st:hover .wf-st-more, .wf-st.on .wf-st-more, .wf-st-more:focus-visible { opacity: 1; }
.wf-st-more:hover { background: rgba(255, 138, 27, .22); color: #c85f00; }
@media (hover: none) { .wf-st-more { opacity: 1; } }
.wf-nbcolors { display: inline-flex; gap: 6px; margin: 0; flex: 0 0 auto; }
.wf-nbcolors button { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .2); }
.wf-nbcolors button.on { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- BitLang programs, dressed in the Waterflow theme (chip, running view, editor) ---------- */
body .bl-prog { --main: var(--aqua2); --soft: #d2f7fc; gap: 8px; padding: 3px 6px 3px 4px; border-radius: 999px; border: 2px solid var(--main); background: var(--soft); color: color-mix(in srgb, var(--main) 72%, #000); font: 600 13px/1.3 var(--font); box-shadow: none; }
body[data-theme="night"] .bl-prog { --soft: #12395e; color: var(--ink); }
body .bl-prog:hover { filter: none; background: color-mix(in srgb, var(--soft) 72%, var(--main)); box-shadow: none; }
body .bl-prog.bl-playing { --main: var(--orange); --soft: #ffe9d0; box-shadow: none; }
body[data-theme="night"] .bl-prog.bl-playing { --soft: #4a2a0c; }
body .bl-chip-icon { width: 20px; height: 20px; border-radius: 50%; background: var(--main); box-shadow: none; }
body .bl-chip-icon::before { color: #fff; font-size: 9px; text-shadow: none; }
body .bl-prog.bl-playing .bl-chip-icon { background: var(--main); }
body .bl-prog.bl-playing .bl-chip-icon::before { color: #fff; }
body .bl-chip-text::before { color: var(--orange); font-weight: 700; }
body .bl-chip-text::after { color: var(--main); }
body .bl-chip-edit { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--main); background: #fff; color: color-mix(in srgb, var(--main) 72%, #000); }
body[data-theme="night"] .bl-chip-edit { background: #0b2a4a; color: var(--aqua1); }
body .bl-chip-edit:hover { color: #fff; background: var(--main); border-color: var(--main); }

/* the running program and its dialogs follow the Poolside Style Lookup (PSL) UI: 2px main-color borders, light fills, round pills */
body .bl-view { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; min-height: 0; color: inherit; }
body .bl-over-stop { top: 0; right: 0; font: 700 12px var(--font); padding: 4px 14px; border-radius: 999px; border: 2px solid var(--orange); background: #ffe9d0; color: var(--or3); text-shadow: none; box-shadow: none; }
body .bl-over-stop:hover { filter: none; background: var(--orange); color: #fff; }
body .bl-btn { font: 700 13px var(--font); padding: 5px 14px; border: 2px solid #36cdee; background: #d2f7fc; color: #0a93b2; text-shadow: none; box-shadow: none; transform: none; }
body .bl-btn:hover { filter: none; transform: none; background: #36cdee; color: #fff; }
body .bl-btn:active { transform: translateY(1px); }
body[data-theme="night"] .bl-btn { background: #12395e; color: #9fe7f7; }
body[data-theme="night"] .bl-btn:hover { background: #36cdee; color: #fff; }
body .bl-in { border: 2px solid #36cdee; border-radius: 999px; background: #fff; color: #0b2a44; box-shadow: none; }
body .bl-in:focus { border-color: #36cdee; box-shadow: 0 0 0 3px rgba(54, 205, 238, .3); }
body .bl-error { color: var(--red); background: #fff; border: 2px solid var(--red); border-radius: 12px; }

body .bl-edit-back, body .bl-docs-back { background: rgba(5, 40, 70, .45); backdrop-filter: none; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
body .bl-edit-dlg, body .bl-docs-dlg { border: 2px solid #36cdee; border-radius: 18px; background: #f2fcff; color: #0b2a44; box-shadow: 0 20px 60px rgba(0, 40, 80, .4); }
body[data-theme="night"] .bl-edit-dlg, body[data-theme="night"] .bl-docs-dlg { background: #0d2640; color: #e6f4ff; }
body .bl-docs-head { background: #d2f7fc; color: #0b2a44; border-bottom: 2px solid #36cdee; font: 700 17px system-ui, sans-serif; padding: 12px 16px; }
body[data-theme="night"] .bl-docs-head { background: #12395e; color: #e6f4ff; }
body .bl-docs-x { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #36cdee; background: #fff; color: #0a93b2; font-weight: 800; line-height: 1; }
body .bl-docs-x:hover { background: #36cdee; color: #fff; }
body .bl-edit-lbl { color: #0a93b2; font-weight: 700; }
body[data-theme="night"] .bl-edit-lbl { color: #9fe7f7; }
body .bl-edit-name { font: 14px system-ui, sans-serif; border: 2px solid #36cdee; border-radius: 999px; padding: 8px 14px; background: #fff; color: #0b2a44; outline: none; }
body .bl-edit-name:focus { box-shadow: 0 0 0 3px rgba(54, 205, 238, .3); }
body .bl-edit-foot { background: #f2fcff; border-top: 1px solid #b9ecf7; }
body[data-theme="night"] .bl-edit-foot { background: #0d2640; border-top-color: #12395e; }
body .bl-docs { background: #fff; color: #0a93b2; }
body .bl-seg { border: 2px solid #36cdee; box-shadow: none; }
body .bl-seg-b { font: 700 12px system-ui, sans-serif; background: #fff; color: #0a93b2; }
body .bl-seg-b + .bl-seg-b { border-left: 2px solid #36cdee; }
body .bl-seg-b.on { background: #36cdee; color: #fff; text-shadow: none; }
body .bl-seg-note { color: #4d6e89; }
body .bl-docs-body h1, body .bl-docs-body h2 { color: #0a93b2; }
body .bl-docs-body h2 { border-bottom: 1px solid #b9ecf7; }
body .bl-docs-body code { background: #d2f7fc; color: #0a93b2; }
