:root {
  --fs: 11pt;
  --font: Arial, Helvetica, sans-serif;
  --lh: calc(var(--fs) * 1.5);
  --paper: #ffffff;
  --ink: #111111;
  --line: rgba(0, 70, 160, .2);

  /* glass theme */
  --txt: #1c1d21;
  --muted: #6d727c7e;
  --hi: #20f5c0;                       /* highlight color for whatever is in use */
  --hi-soft: rgba(255, 176, 110, .42);
  --glass: linear-gradient(180deg, rgba(255, 255, 255, .92) 0%, rgba(241, 243, 246, .62) 55%, rgba(226, 230, 236, .7) 100%);
  --glass-edge: rgba(255, 255, 255, .95);
  --glass-shadow: inset 0 1.5px 1px rgba(255, 255, 255, 1), inset 0 -4px 7px rgba(125, 135, 155, .2), 0 1px 1.5px rgba(60, 70, 90, .22), 0 5px 12px rgba(70, 80, 100, .13);
  --glass-press: inset 0 2px 5px rgba(90, 100, 120, .3), inset 0 -1px 1px rgba(255, 255, 255, .9), 0 1px 1px rgba(255, 255, 255, .8);
  --glass-on: inset 0 1.5px 1px rgba(255, 255, 255, .95), inset 0 -5px 9px rgba(255, 150, 60, .35), 0 1px 1.5px rgba(150, 90, 40, .3), 0 5px 16px rgba(255, 150, 60, .45);
  --field: linear-gradient(180deg, rgba(222, 226, 232, .75), rgba(250, 251, 252, .85));
  --field-shadow: inset 0 2px 4px rgba(90, 100, 120, .28), inset 0 -1px 0 rgba(255, 255, 255, .9), 0 1px 0 rgba(255, 255, 255, .9);
  --panel: rgba(255, 255, 255, .5);
  /* ===== FROSTED GLASS NAV BAR — change these numbers to test =====
     The note scrolls up underneath the nav bar and shows through it, blurred.
     --nav-blur     how frosted the glass is.   0px = clear glass, 12px = frosted (current), 18px = heavy frost, 30px+ = very milky
     --nav-tint     how white the glass is.     0 = no tint (most see-through), .15 = current, .35 = milky, .7 = nearly solid white
     --toolbar-tint extra whiteness of the rounded toolbar panel on top of the glass.   0 = none, .12 = current, .4 = strong
     --tab-tint     how solid the tabs are.     .2 = very see-through, .35 = current, .9 = almost solid
     --nav-shine    colour boost of what shows through.   1 = natural, 1.6 = current, 2 = vivid */
  --nav-blur: 12px;
  --nav-tint: .15;
  --toolbar-tint: .12;
  --tab-tint: .35;
  --nav-shine: 1.6;
  --nav-h: 114px;                      /* height of the nav bar — set automatically by app.js, don't edit */
  --panel-shadow: inset 0 1.5px 1px rgba(255, 255, 255, 1), inset 0 -3px 8px rgba(125, 135, 155, .14), 0 1px 2px rgba(60, 70, 90, .18), 0 8px 22px rgba(70, 80, 100, .14);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column; height: 100dvh; overflow: hidden;
  font: 14px/1.3 system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--txt);
  background: radial-gradient(900px 380px at 12% -8%, #ffffff 0%, rgba(255, 255, 255, 0) 70%), radial-gradient(700px 300px at 95% 0%, #fdf3ea 0%, rgba(253, 243, 234, 0) 70%), linear-gradient(180deg, #f2f3f5, #e3e6ea);
  overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--hi); outline-offset: 1px; }
[hidden] { display: none !important; }

/* ---------- nav bar: one frosted-glass sheet floating over the note (settings at the top of this file) ---------- */
#nav {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  background: linear-gradient(180deg, rgba(255, 255, 255, calc(var(--nav-tint) + .1)), rgba(255, 255, 255, var(--nav-tint)));
  -webkit-backdrop-filter: blur(var(--nav-blur)) saturate(var(--nav-shine)); backdrop-filter: blur(var(--nav-blur)) saturate(var(--nav-shine));
  border-bottom: 1px solid rgba(255, 255, 255, .7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 1px 0 rgba(120, 130, 150, .15), 0 6px 18px rgba(70, 80, 100, .10);
}

/* ---------- top bar: glass tabs, clock, window buttons ---------- */
#topbar {
  display: flex; align-items: flex-end; height: 46px; flex: none; gap: 4px;
  padding: 0 calc(8px + env(safe-area-inset-right)) 0 calc(14px + env(safe-area-inset-left));
  user-select: none; -webkit-user-select: none;
}
#tabs { display: flex; align-items: flex-end; gap: 3px; min-width: 0; height: 100%; overflow-x: auto; scrollbar-width: none; padding: 0 2px; }
#tabs::-webkit-scrollbar { display: none; }
.tab {
  --c: #4f8ff7;
  display: flex; align-items: center; gap: 6px; flex: none; height: 32px;
  min-width: 92px; max-width: 190px; padding: 0 7px 0 14px;
  font-weight: 600; font-size: 15px; color: var(--txt);
  border-radius: 13px 13px 0 0; border: 1px solid var(--glass-edge); border-bottom: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, calc(var(--tab-tint) + .2)), color-mix(in srgb, var(--c) 22%, rgba(240, 242, 245, var(--tab-tint))));
  box-shadow: inset 0 1.5px 1px rgba(255, 255, 255, .9), inset 0 -3px 6px rgba(125, 135, 155, .12), 0 -1px 2px rgba(60, 70, 90, .08);
}
.tab.on {
  height: 38px; font-weight: 700;
  background: linear-gradient(180deg, rgba(255, 255, 255, calc(var(--tab-tint) + .3)), color-mix(in srgb, var(--c) 55%, rgba(255, 255, 255, var(--tab-tint))));
  box-shadow: inset 0 1.5px 1px #fff, inset 0 -6px 10px color-mix(in srgb, var(--c) 45%, transparent), 0 -2px 10px color-mix(in srgb, var(--c) 45%, transparent);
}
.tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: left; }
.tab .x { flex: none; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-style: normal; line-height: 20px; text-align: center; opacity: .6; }
.tab .x:hover { background: rgba(255, 255, 255, .8); box-shadow: var(--glass-press); opacity: 1; }
.round, #newTab, #winbtns button {
  flex: none; width: 32px; height: 32px; border-radius: 50%; align-self: center;
  background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow);
  display: grid; place-items: center; font-size: 15px; font-weight: 700; line-height: 1;
}
#newTab { font-size: 20px; font-weight: 400; margin-left: 2px; }
#newTab:active, #winbtns button:active { box-shadow: var(--glass-press); }
.grow { flex: 1; min-width: 4px; align-self: stretch; }
#saveState { align-self: center; font-size: 11px; color: var(--muted); margin-right: 6px; white-space: nowrap; }
#saveState.bad { color: #c62828; font-weight: 700; }
#clock { align-self: center; height: 32px; padding: 0 14px; border-radius: 999px; font-weight: 700; font-size: 15px; white-space: nowrap; }
#clock:hover { background: var(--glass); box-shadow: var(--glass-shadow); }
#clock i { font-style: normal; font-weight: 400; margin: 0 7px; opacity: .5; }
#winbtns { display: flex; gap: 6px; align-self: center; }
#wClose:hover { background: linear-gradient(180deg, #ff8f86, #e5483d); color: #fff; }

/* ---------- toolbar: a glass panel holding glass pills ---------- */
#toolbar {
  display: flex; align-items: center; flex: none; min-height: 60px; position: relative; z-index: 6;
  margin: 0 calc(8px + env(safe-area-inset-right)) 8px calc(8px + env(safe-area-inset-left));
  background: rgba(255, 255, 255, var(--toolbar-tint)); border: 1px solid rgba(255, 255, 255, .8); border-radius: 22px; box-shadow: var(--panel-shadow);
  user-select: none; -webkit-user-select: none;
}
body.compact #toolbar { display: none; }
#tools { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; padding: 9px 10px; scrollbar-width: none; }
#tools::-webkit-scrollbar { display: none; }
.tb {
  display: flex; align-items: center; gap: 4px; flex: none; height: 38px; padding: 0 12px;
  border-radius: 999px; font-size: 18px; white-space: nowrap;
  background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow);
  transition: box-shadow .12s, transform .12s;
}
.tb:hover { transform: translateY(-.5px); }
.tb:active, .tb.on { box-shadow: var(--glass-press); transform: none; }
.tb.act { background: linear-gradient(180deg, #fff 0%, #ffe3c7 60%, #ffc995 100%); box-shadow: var(--glass-on); }
.tb.file { font-weight: 800; font-size: 18px; padding: 0 18px; }
.tb .small { font-size: 14px; font-weight: 700; }
.tb .emo { font-size: 19px; line-height: 1; }
.tb svg { width: 21px; height: 21px; fill: currentColor; }
.tb.dd::after { content: ""; width: 6px; height: 6px; border: solid var(--muted); border-width: 0 1.8px 1.8px 0; transform: rotate(45deg); margin: -3px 1px 0 3px; }
#fsize, #search, .row input[type="number"], .row input[type="text"], .row select {
  border: 1px solid rgba(255, 255, 255, .9); border-radius: 999px; background: var(--field); box-shadow: var(--field-shadow);
  color: var(--txt); outline: none;
}
#fsize { flex: none; width: 62px; height: 36px; font: 15px system-ui, sans-serif; text-align: center; padding: 0 4px 0 10px; }
#searchBox { position: relative; flex: 1 1 220px; min-width: 130px; max-width: 420px; margin-left: 4px; }
#search { width: 100%; height: 38px; font: 16px system-ui, sans-serif; padding: 0 62px 0 18px; }
#search::placeholder { color: #9a9ea6; }
#search:focus, #fsize:focus { box-shadow: var(--field-shadow), 0 0 0 2px var(--hi-soft); }
#searchCount { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--muted); pointer-events: none; }

/* layer buttons: four glass circles, name underneath, the one in use glows */
#layers { display: flex; gap: 7px; flex: none; padding: 6px 12px 5px 10px; border-left: 1px solid rgba(130, 140, 160, .22); box-shadow: inset 1px 0 0 rgba(255, 255, 255, .9); }
#layers button { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 36px; font-size: 10.5px; line-height: 1; color: var(--muted); }
#layers .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow); color: #3b3f47; transition: box-shadow .12s; }
#layers svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#layers button:active .ic { box-shadow: var(--glass-press); }
#layers button.on { color: #c45f00; font-weight: 700; }
#layers button.on .ic { background: linear-gradient(180deg, #fff 0%, #ffd9b0 55%, #ffb066 100%); box-shadow: var(--glass-on); color: #7a3a00; }

/* ---------- workspace and the four layers ---------- */
#work { flex: 1; min-height: 0; overflow: auto; padding-top: var(--nav-h); scroll-padding-top: calc(var(--nav-h) + 8px); display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; }
#page { position: relative; flex: 1 0 auto; display: flex; flex-direction: column; background: var(--paper); box-shadow: 0 -1px 0 rgba(255, 255, 255, .9), 0 -2px 10px rgba(70, 80, 100, .12); }
#page.sized { flex: 0 0 auto; align-self: flex-start; margin: 6px 14px 14px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .9), 0 6px 22px rgba(70, 80, 100, .28); }

#lBg { position: absolute; inset: 0; z-index: 0; background-color: var(--paper); pointer-events: none; }
#lBg.notebook { background-image: linear-gradient(to bottom, transparent calc(var(--lh) - 1px), var(--line) calc(var(--lh) - 1px)); background-size: 100% var(--lh); }
#lBg.grid { background-image: linear-gradient(to bottom, transparent calc(var(--lh) - 1px), var(--line) calc(var(--lh) - 1px)), linear-gradient(to right, transparent calc(var(--lh) - 1px), var(--line) calc(var(--lh) - 1px)); background-size: var(--lh) var(--lh); }
#lBg.dotted { background-image: radial-gradient(circle, var(--line) 1.3px, transparent 1.7px); background-size: var(--lh) var(--lh); background-position: calc(var(--lh) / 2) calc(var(--lh) / 2); }

.imgLayer { position: absolute; inset: 0; pointer-events: none; }
#lImgBehind { z-index: 1; }
#lImgAbove { z-index: 4; }
.fimg { position: absolute; pointer-events: auto; touch-action: none; cursor: move; }
.fimg img { width: 100%; height: 100%; display: block; -webkit-user-drag: none; user-select: none; -webkit-user-select: none; pointer-events: none; }
.fimg.sel { outline: 2px solid var(--hi); }
.fimg .hd { display: none; position: absolute; width: 16px; height: 16px; background: #fff; border: 2px solid var(--hi); border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.fimg.sel .hd { display: block; }
.hd.se { right: -9px; bottom: -9px; cursor: nwse-resize; }
.hd.e { right: -9px; top: calc(50% - 8px); cursor: ew-resize; }
.hd.s { bottom: -9px; left: calc(50% - 8px); cursor: ns-resize; }
body[data-layer="pen"] .fimg { pointer-events: none; }
body[data-layer="img"] #editor { pointer-events: none; }

#pen, #penLive { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }
body[data-layer="pen"] #pen { pointer-events: auto; touch-action: none; cursor: crosshair; }

#pageResize { position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; z-index: 5; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,.3) 50%, rgba(0,0,0,.3) 58%, transparent 58%, transparent 68%, rgba(0,0,0,.3) 68%, rgba(0,0,0,.3) 76%, transparent 76%, transparent 86%, rgba(0,0,0,.3) 86%); }

/* ---------- text layer ---------- */
#editor {
  position: relative; z-index: 2; flex: 1; outline: none;
  padding: var(--lh) 28px calc(var(--lh) * 3);
  font: var(--fs)/1.5 var(--font); color: var(--ink); caret-color: var(--ink);
  white-space: pre-wrap; overflow-wrap: break-word; tab-size: 4; column-gap: 36px;
}
#editor:empty::before { content: "Start typing…"; opacity: .4; pointer-events: none; }
#editor p, #editor h1, #editor h2, #editor h3, #editor h4, #editor h5, #editor h6 { margin: 0; }
#editor h1 { font-size: 2em; line-height: 1.5; font-weight: 800; }
#editor h2 { font-size: 1.25em; line-height: 1.2; font-weight: 400; opacity: .7; }
#editor h3 { font-size: 1.6em; line-height: 1.875; font-weight: 700; }
#editor h4 { font-size: 1.3em; line-height: 1.1538; font-weight: 700; }
#editor h5 { font-size: 1.15em; line-height: 1.3043; font-weight: 700; text-decoration: underline; }
#editor h6 { font-size: 1em; line-height: 1.5; font-weight: 700; font-style: italic; }
#editor ul, #editor ol { margin: 0; padding-left: 1.8em; }
#editor ul.check { list-style: none; padding-left: 0; }
#editor ul.check > li { position: relative; padding-left: 1.7em; }
#editor ul.check > li::before { content: ""; position: absolute; left: .15em; top: .25em; width: .95em; height: .95em; border: 1.5px solid currentColor; border-radius: 3px; cursor: pointer; }
#editor ul.check > li.done::before { content: "✓"; font-size: .8em; line-height: 1.1; text-align: center; font-weight: 700; width: 1.19em; height: 1.19em; }
#editor ul.check > li.done { text-decoration: line-through; opacity: .6; }
#editor table { border-collapse: collapse; table-layout: fixed; width: 100%; margin: calc(var(--lh) / 2) 0; white-space: normal; }
#editor td, #editor th { border: 1px solid currentColor; padding: 3px 7px; vertical-align: top; min-width: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
#editor img { max-width: 100%; }
#editor img.inl { vertical-align: middle; width: auto; object-fit: contain; cursor: pointer; }
#editor img.inl.s { height: 2em; }
#editor img.inl.m { height: 7em; }
#editor img.inl.l { height: 16em; }
#editor img.sel { outline: 2px solid var(--hi); }
::highlight(wk-find) { background: #ffe14d; color: #000; }
::highlight(wk-cur) { background: #ff8a00; color: #000; }

/* ---------- glass menus ---------- */
.menu {
  display: none; position: fixed; z-index: 50; min-width: 200px; max-width: min(340px, calc(100vw - 12px)); overflow: auto; padding: 7px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .88), rgba(240, 242, 246, .8)); border: 1px solid var(--glass-edge); border-radius: 20px;
  box-shadow: inset 0 1.5px 1px #fff, inset 0 -4px 10px rgba(125, 135, 155, .14), 0 2px 4px rgba(60, 70, 90, .16), 0 16px 40px rgba(60, 70, 90, .26);
  -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4);
  user-select: none; -webkit-user-select: none;
}
.menu.open { display: block; }
.mi { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; padding: 9px 13px; border-radius: 13px; text-align: left; font-size: 15px; border: 1px solid transparent; }
.mi:hover { background: var(--glass); border-color: var(--glass-edge); box-shadow: var(--glass-shadow); }
.mi:active { box-shadow: var(--glass-press); }
.mi.on { background: linear-gradient(180deg, #fff 0%, #ffe6cd 60%, #ffd0a3 100%); border-color: var(--glass-edge); box-shadow: var(--glass-on); }
.mi kbd { font: 11px system-ui, sans-serif; color: var(--muted); }
.menu hr { border: 0; height: 2px; margin: 6px 8px; background: linear-gradient(180deg, rgba(130, 140, 160, .25) 50%, rgba(255, 255, 255, .95) 50%); }
.ml { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 7px 13px 4px; }
.sw { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 12px 7px; align-items: center; }
.sw .s { width: 27px; height: 27px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .9); box-shadow: inset 0 2px 2px rgba(255, 255, 255, .55), inset 0 -3px 4px rgba(0, 0, 0, .14), 0 1px 3px rgba(60, 70, 90, .4); }
.sw .s.on { box-shadow: inset 0 2px 2px rgba(255, 255, 255, .55), 0 0 0 2px #fff, 0 0 0 4.5px var(--hi), 0 3px 10px rgba(255, 150, 60, .6); }
.sw input[type="color"] { width: 38px; height: 28px; padding: 0 3px; border: 1px solid var(--glass-edge); border-radius: 999px; background: var(--glass); box-shadow: var(--glass-shadow); }
.row { display: flex; align-items: center; gap: 8px; padding: 5px 12px; font-size: 14px; }
.row input[type="range"] { flex: 1; min-width: 90px; accent-color: var(--hi); }
.row input[type="number"], .row input[type="text"], .row select { flex: 1; min-width: 0; height: 34px; padding: 0 12px; font: inherit; }
.row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--hi); }
.seg { display: flex; gap: 5px; padding: 4px 12px; }
.seg button { flex: 1; padding: 8px 4px; border-radius: 999px; font-size: 13px; background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow); }
.seg button:active { box-shadow: var(--glass-press); }
.seg button.on { background: linear-gradient(180deg, #fff 0%, #ffe3c7 60%, #ffc995 100%); box-shadow: var(--glass-on); font-weight: 700; }
.tpick { display: grid; grid-template-columns: repeat(10, 20px); gap: 3px; padding: 4px 13px; touch-action: none; }
.tpick i { width: 20px; height: 20px; border-radius: 5px; background: var(--field); box-shadow: var(--field-shadow); }
.tpick i.h { background: linear-gradient(180deg, #ffe3c7, #ffb066); box-shadow: inset 0 1px 1px #fff, 0 1px 3px rgba(255, 150, 60, .6); }
.egrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px; padding: 2px 7px; }
.egrid button { font-size: 22px; height: 36px; border-radius: 12px; }
.egrid.sym button { font-size: 18px; }
.egrid button:hover { background: var(--glass); box-shadow: var(--glass-shadow); }

/* ---------- image bar, toast, dialogs ---------- */
#imgBar {
  display: none; position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40; gap: 5px; padding: 7px;
  background: rgba(255, 255, 255, .62); border: 1px solid var(--glass-edge); border-radius: 999px; box-shadow: var(--panel-shadow), 0 12px 30px rgba(60, 70, 90, .25);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  max-width: calc(100vw - 12px); overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
#imgBar.open { display: flex; }
#imgBar button { padding: 9px 13px; border-radius: 999px; font-size: 13px; background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow); }
#imgBar button:active { box-shadow: var(--glass-press); }
#imgBar button.on { background: linear-gradient(180deg, #fff 0%, #ffe3c7 60%, #ffc995 100%); box-shadow: var(--glass-on); font-weight: 700; }
#toast {
  position: fixed; left: 50%; top: 124px; transform: translateX(-50%); z-index: 90; padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: rgba(255, 255, 255, .85); border: 1px solid var(--glass-edge); box-shadow: var(--panel-shadow), 0 10px 26px rgba(60, 70, 90, .25);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw;
}
#toast.show { opacity: 1; }
dialog {
  border: 1px solid var(--glass-edge); border-radius: 26px; padding: 0; color: var(--txt);
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 40px);
  background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(238, 241, 245, .86));
  box-shadow: inset 0 1.5px 1px #fff, inset 0 -5px 12px rgba(125, 135, 155, .14), 0 20px 60px rgba(50, 60, 80, .35);
  -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
}
dialog::backdrop { background: rgba(225, 229, 235, .55); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
dialog header { display: flex; justify-content: space-between; align-items: center; padding: 14px 14px 12px 22px; font-size: 18px; }
dialog header .x { width: 32px; height: 32px; border-radius: 50%; background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow); }
dialog .body { padding: 4px 14px 18px; }
dialog .body.center { text-align: center; padding: 30px; }
dialog .row { padding: 7px 8px; }
dialog .row label { flex: 0 0 46%; }
dialog .row input[type="color"] { width: 54px; height: 34px; padding: 0 4px; border: 1px solid var(--glass-edge); border-radius: 999px; background: var(--glass); box-shadow: var(--glass-shadow); }
.btn { padding: 11px 22px; border-radius: 999px; font-weight: 700; background: linear-gradient(180deg, #fff 0%, #fff1e2 55%, #ffd9b3 100%); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow), 0 6px 16px rgba(255, 160, 80, .35); }
.btn:active { box-shadow: var(--glass-press); }
.nrow { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 16px; text-align: left; cursor: pointer; border: 1px solid transparent; }
.nrow:hover { background: var(--glass); border-color: var(--glass-edge); box-shadow: var(--glass-shadow); }
.nrow .dot { flex: none; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 2px 2px rgba(255, 255, 255, .6), inset 0 -2px 3px rgba(0, 0, 0, .15), 0 1px 3px rgba(60, 70, 90, .4); }
.nrow .t { flex: 1; min-width: 0; }
.nrow .t b, .nrow .t small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nrow .t small { color: var(--muted); }
.nrow .del { flex: none; padding: 7px 12px; border-radius: 999px; color: #b3261e; font-size: 13px; }
.nrow .del:hover { background: #fff; box-shadow: var(--glass-shadow); }

/* ---------- small screens ---------- */
@media (max-width: 700px) {
  #topbar { padding-left: calc(8px + env(safe-area-inset-left)); gap: 3px; }
  #toolbar { min-height: 56px; margin: 0 5px 6px; border-radius: 20px; }
  #tools { padding: 8px; gap: 5px; }
  /* phones: tools scroll on the first row, the four layer buttons sit together on a second row */
  #toolbar { flex-wrap: wrap; }
  #tools { flex: 1 1 100%; }
  #layers { flex: 1 1 100%; justify-content: space-around; gap: 4px; padding: 5px 8px 6px; border-left: 0; border-top: 1px solid rgba(130, 140, 160, .22); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9); }
  #layers button { width: 44px; font-size: 10.5px; }
  #layers .ic { width: 30px; height: 30px; }
  #layers svg { width: 16px; height: 16px; }
  #editor { padding-left: 16px; padding-right: 16px; }
  #saveState { display: none; }
  .tab { min-width: 72px; font-size: 14px; padding-left: 10px; }
  #clock { font-size: 12px; padding: 0 6px; }
  #clock i { margin: 0 4px; }
  #winbtns { gap: 4px; }
  .round, #newTab, #winbtns button { width: 28px; height: 28px; font-size: 13px; }
}
@media (max-width: 430px) { #wMin { display: none; } }

/* ---------- installed desktop app with the title bar merged into the tab strip ---------- */
@media (display-mode: window-controls-overlay) {
  #topbar { padding-left: calc(14px + env(titlebar-area-x, 0px)); padding-right: calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100vw) + 8px); -webkit-app-region: drag; app-region: drag; }
  #topbar button, #tabs { -webkit-app-region: no-drag; app-region: no-drag; }
  #winbtns { display: none; }
}

/* ---------- printing: only the note ---------- */
@media print {
  #nav, #topbar, #toolbar, #imgBar, .menu, #toast, #pageResize, dialog { display: none !important; }
  html, body { height: auto; overflow: visible; background: #fff; }
  body { display: block; }
  #work { display: block; overflow: visible; padding-top: 0; }
  #page, #page.sized { margin: 0; box-shadow: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .fimg.sel, #editor img.sel { outline: none; }
  .fimg .hd { display: none !important; }
}
