:root{
  --bg:#0a0c11; --panel:rgba(20,24,33,.94); --border:rgba(255,255,255,.09);
  --text:#f2f4f8; --muted:#8b93a7; --danger:#ff453a;
  /* The new logo's ribbon (inko/icon.svg): amber, coral, magenta, violet,
     blue, cyan. The middle of it is the accent; the whole of it is --grad.
     (The cyan-to-lilac these replaced was the OLD logo's.) */
  --bar-h:66px; --a1:#f12fc6; --a2:#8a32f4; --a3:#3458f5;
  --grad:linear-gradient(120deg,#ff6a72 0%,#f12fc6 34%,#8a32f4 68%,#3458f5 100%);
  --glow:0 6px 20px -6px rgba(241,47,198,.55), 0 2px 10px -4px rgba(52,88,245,.5);
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
html,body{height:100%;height:100svh;}
html{position:fixed;width:100%;overflow:hidden;}
body{
  margin:0; height:100%; height:100svh; height:100dvh; overflow:hidden; display:flex; flex-direction:column; align-items:center;
  position:fixed; width:100%; top:0; left:0;
  padding-bottom:0;
  background:radial-gradient(130% 90% at 50% -10%, #151b2b 0%, var(--bg) 55%) fixed, var(--bg);
  color:var(--text); font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text",Inter,system-ui,sans-serif;
  user-select:none; -webkit-user-select:none; overscroll-behavior:none;
}
/* Top: title only — no buttons above the 50% line */
#topbar{
  width:100%; display:flex; justify-content:center; flex-shrink:0;
  padding:calc(env(safe-area-inset-top,0px) + 14px) 16px 8px;
}
#topbar{flex-direction:column; align-items:center;}
/* The tool in hand, under the title: one name at a time. */
#tool-name{font-size:12.5px; line-height:1.25; font-weight:600; color:var(--muted); letter-spacing:.02em;
  margin-top:1px; min-height:1.25em; white-space:nowrap;}
#title-input{
  background:transparent; border:none; outline:none; color:var(--text);
  font-size:21px; font-weight:700; text-align:center; width:70%;
}
#title-input::placeholder{color:var(--muted);}
/* The canvas's public/private lock, at the row's right edge, the mirror of
   the canvas swatch at its left. */
#top-lock{
  position:absolute; right:14px; top:50%; transform:translateY(-50%);
  width:46px; height:46px; border-radius:15px; border:1px solid var(--border);
  background:var(--panel); color:var(--text); cursor:pointer;
  display:flex; align-items:center; justify-content:center;
}
#top-lock svg{width:25px; height:25px;}
#top-lock.on{background:var(--grad); color:#fff; border-color:transparent; box-shadow:var(--glow);}
#topbar{position:relative;}

/* Canvas stage */
/* The canvas sits ON the bars: one gap (--gap, the same 8px as between the
   size bar and the toolbar) under it. The stage is fixed and fit() sets its
   top and bottom from the topbar's and the panels' own boxes, so opening the
   sliders, the options or the canvas colour window lifts it. */
#stage{
  --gap:8px;   /* GAP in app.js */
  position:fixed; left:0; right:0; top:60px; bottom:150px; box-sizing:border-box;
  display:flex; align-items:flex-end; justify-content:center; width:100%; min-height:0;
  padding:6px 0 var(--gap); touch-action:none; overscroll-behavior:none;}
#canvas-frame{
  border-radius:20px; overflow:hidden; border:none;
  box-shadow:0 18px 50px rgba(0,0,0,.5); background:#536980; line-height:0;
}
#pad{touch-action:none; background:#536980; display:block;}
/* A new or opened canvas (Dex, 2026-10-08, second take): a gentle
   crossfade. The one you were on (.pad-snap, a copy of #pad laid over it)
   fades out while the new one fades in a beat behind it, both eased, over
   the frame's own darker fill -- so even two blank canvases of one colour
   dip slightly and come back, and nothing sweeps across. The first take was
   a diagonal wipe, and read as far too abrupt. See snapPad() in app.js; the
   timings are --fade-ms and --fade-lag. */
#canvas-frame{position:relative;}
#canvas-frame.swap{background:#11131a;}
.pad-snap{position:absolute; left:0; top:0; pointer-events:none;}
#canvas-frame.swap #pad{opacity:0;}
.pad-snap.go{animation:padOut var(--fade-ms,700ms) ease-in-out forwards;}
#canvas-frame.swap.go #pad{animation:padIn var(--fade-ms,700ms) ease-in-out var(--fade-lag,140ms) both;}
@keyframes padOut{from{opacity:1} to{opacity:0}}
@keyframes padIn{from{opacity:0} to{opacity:1}}
#copt-dot{width:26px; height:26px; border-radius:9px; display:block; border:1px solid rgba(255,255,255,.25);}
#copt-btn.on{box-shadow:inset 0 0 0 2px #f12fc6;}
/* The canvas window opened from the options bar: title and public too. */
/* The title spans the whole H/S/B block, its left edge at the letters and its
   text centred, 18px (Dex, 2026-10-08); the lock stands over the redo column
   at the left and an X over the undo column at the right. placeCanvasTitle()
   sets all three from the block's and the buttons' own boxes. */
#cp-more{position:relative; height:44px; margin:6px 0 2px;}
#cp-more[hidden]{display:none;}
#cp-title{position:absolute; top:0; height:44px; left:0; width:60%; box-sizing:border-box; min-width:0;
  background:rgba(255,255,255,.06); border:1px solid var(--border); border-radius:12px;
  color:var(--text); font-family:inherit; font-weight:700; font-size:18px; line-height:1.2; padding:0 12px; outline:none; text-align:center;}
/* (Longhands: "font:700 16px/1.2 inherit" is not a valid shorthand -- inherit cannot be a family there -- so the
   whole line was dropped and the field had been at the browser's 13.3px all along.) */
#cp-more .cp-lock{position:absolute; top:0; left:0;}
#cp-more #cp-close{left:auto; right:0;}
#cp-title:focus{border-color:#8a32f4;}
.cp-lock{flex:none; width:44px; height:44px; border-radius:14px; border:1px solid var(--border); background:rgba(255,255,255,.06);
  color:var(--text); display:flex; align-items:center; justify-content:center; cursor:pointer;}
.cp-lock svg{width:22px; height:22px;}
#cp-close svg{width:18px; height:18px;}
.cp-lock.on{background:var(--grad); border-color:transparent; color:#fff;}
/* Bottom toolbar pill */

/* Permanent size bar above toolbar */
#bottom-bars{
  position:fixed; bottom:0; left:0; right:0; z-index:50;
  display:flex; flex-direction:column; align-items:center;
  padding-bottom:calc(env(safe-area-inset-bottom,0px) + 8px);
  pointer-events:none;
}
#bottom-bars > *{pointer-events:auto;}

/* The swatch expands the one brush panel: H/S/B above size. */
#hsb-bar{
  display:flex; width:100%;
}
/* Redo | the three sliders | undo, the buttons level with S (Dex, 2026-10-08). */
.hsb-rows{flex:1; min-width:0; display:flex; flex-direction:column; gap:0;}
#hsb-bar .tbtn{flex:0 0 auto;}
.hsb-row{display:flex; align-items:center; gap:10px;}
/* A taller strip to land a finger on; the track and thumb look the same. */
.hsb-row input[type=range]{height:38px;}
.hsb-lbl{
  width:18px; font-size:14px; font-weight:700; color:var(--text);
  text-align:center; flex-shrink:0;
}
.hsb-row input[type=range]{flex:1; accent-color:var(--accent);}
/* Canvas swatch in topbar */
#canvas-swatch{
  position:absolute; left:16px; top:50%; transform:translateY(-50%);
  width:36px; height:36px; border-radius:12px; border:1px solid var(--border);
  background:var(--panel); cursor:pointer; display:flex; align-items:center; justify-content:center;
}
#cs-dot{width:22px; height:22px; border-radius:8px; display:block;}
#topbar{position:relative;}

#size-bar{
  flex-shrink:0;
  display:flex; align-items:center; gap:8px;
  width:calc(100vw - 20px); max-width:600px;
  background:var(--panel); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
  border:1px solid var(--border); border-radius:26px;
  /* The same box as the toolbar (Dex, 2026-10-08): just the scrub bar
     between undo and redo, all on one centre line. The pixel size shows
     only while dragging, in #size-preview. */
  box-sizing:border-box; height:var(--bar-h); padding:0 14px; margin-bottom:8px;
}
#brush-controls{flex:1; min-width:0;}
#size-bar.color-open{height:auto; padding-top:6px; padding-bottom:6px; border-radius:18px;}
#size-bar.color-open input[type=range]{height:32px; margin:0 2px;}
#size-bar .size-label{display:none;}
#size-bar.color-open .size-label{display:block;}
#size-bar.color-open #ctl-size-perm{gap:10px;}
#size-bar.color-open #size{flex:1; min-width:0;}
/* The options bar takes the size bar's place, in the same box. */
#opt-bar{
  flex-shrink:0; display:flex; align-items:center; justify-content:space-evenly;
  width:calc(100vw - 20px); max-width:600px;
  background:var(--panel); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
  border:1px solid var(--border); border-radius:26px;
  box-sizing:border-box; height:var(--bar-h); padding:0 14px; margin-bottom:8px;
}
#opt-bar[hidden]{display:none;}
/* H/S/B named while you touch them: centred above the panel, in its fill. */
#size-bar{position:relative;}
.hsb-tip{position:absolute; left:50%; bottom:calc(100% + 8px); transform:translateX(-50%);
  background:var(--panel); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
  border:1px solid var(--border); border-radius:12px; padding:7px 14px;
  font-size:15px; font-weight:700; color:var(--text); white-space:nowrap; pointer-events:none;
  font-variant-numeric:tabular-nums;}
.hsb-tip[hidden]{display:none;}
/* Symmetry on: a short tick across the top centre of the canvas, not a line through it. */
/* In the app's gradient, magenta down to blue (Dex, 2026-10-08). */
#sym-tick{position:absolute; width:4px; height:18px; margin-left:-2px; border-radius:2px; z-index:2;
  background:linear-gradient(180deg,#f12fc6 0%,#8a32f4 55%,#3458f5 100%);
  box-shadow:0 0 0 1px rgba(0,0,0,.3), 0 0 10px rgba(241,47,198,.55); pointer-events:none;}
#sym-tick[hidden]{display:none;}
#size-bar .ctl{margin:0; flex:1; min-width:0; display:flex; align-items:center;}
#size-bar .tbtn{flex:0 0 auto;}
#size-bar .mrow{display:flex; justify-content:space-between; align-items:center; margin-bottom:6px;}
#size-bar .mrow.centered{justify-content:center;}
#size-bar .mrow.centered #size-v{font-size:14px; font-weight:700; color:var(--text);}
#size-bar .mrow span:first-child{font-size:13px; font-weight:600; color:var(--text);}
#size-bar .mrow span:last-child{font-size:13px; color:var(--muted); font-variant-numeric:tabular-nums;}
#size-bar input[type="range"]{width:100%; accent-color:var(--accent);}

#toolbar{
  flex-shrink:0;
  display:flex; align-items:center; justify-content:space-between;
  width:calc(100vw - 20px); max-width:600px;
  background:var(--panel); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
  border:1px solid var(--border); border-radius:26px;
  box-sizing:border-box; height:var(--bar-h); padding:0 14px;
  margin-bottom:0;
}
/* The draw/erase toggle sits dead centre; each half spreads its buttons
   evenly across its own width, so the gaps match and the toggle never
   drifts with how many buttons a side has. */
.tb-side{display:flex; flex:1 1 0; justify-content:space-evenly; align-items:center;}
.tb-mid{display:flex; align-items:center; flex:0 0 auto;}
.tbtn{
  width:44px; height:44px; border-radius:14px; border:none; background:transparent;
  color:var(--text); display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.tbtn svg{width:22px; height:22px; display:block;}
.tbtn{line-height:0;}
.tbtn.sel{background:rgba(255,255,255,.12);}
.tbtn:disabled{opacity:.28;}
/* ON: a ring of the logo's ribbon round a faint wash of it, and a glow --
   the icon stays white, so it reads as lit rather than as a coloured blob. */
.tbtn.on{
  background:linear-gradient(rgba(30,18,44,.92),rgba(30,18,44,.92)) padding-box, var(--grad) border-box;
  border:2px solid transparent; color:#fff; box-shadow:var(--glow);
}
.tbtn{transition:background .18s, box-shadow .18s;}
/* Brush and eraser, both on the button: the tool in use big, the other
   small in the top-left corner. swapTools() flies them between the two. */
#tool-toggle{position:relative; width:52px; height:48px;}
#tool-toggle .tool-ico{position:absolute; left:50%; top:50%; width:26px; height:26px; margin:-13px 0 0 -13px; transform-origin:50% 50%;}
/* The big one dead centre (Dex, 2026-10-08). To revert to the old nudge
   down-right, use translate(2px,2px) here and in TOOL_BIG in app.js. */
#tool-toggle .tool-ico.big{transform:translate(0px,0px) scale(1);}
#tool-toggle .tool-ico.small{transform:translate(-16px,-14px) scale(.46); opacity:.7;}

#plus-btn svg{width:24px; height:24px;}

#color-dot{
  width:24px; height:24px; border-radius:50%;
  background:#ff2d2d; border:2px solid rgba(255,255,255,.3);
  box-shadow:0 0 0 1px rgba(0,0,0,.2);
  display:block;
}

/* Brush settings popover */
/* The canvas window: a panel in the bars, built exactly like #hsb-bar so its
   sliders land where the brush colour's do (Dex, 2026-10-08). */
#brush-pop{
  flex-shrink:0; position:relative; display:none; flex-direction:column;
  width:calc(100vw - 20px); max-width:600px; box-sizing:border-box;
  background:var(--panel); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
  border:1px solid var(--border); border-radius:18px;
  padding:6px 14px; margin-bottom:8px;
}
#brush-pop.open{display:flex;}
#cp-sliders{display:flex; flex-direction:row; align-items:center; gap:8px;}
#cp-sliders .tbtn{flex:0 0 auto;}
.ctl{margin-bottom:12px;}
.ctl:last-child{margin-bottom:0;}
.mrow{display:flex; justify-content:space-between; align-items:center; font-size:13px; color:var(--muted); margin-bottom:6px;}
.mrow span:last-child{color:var(--text); font-variant-numeric:tabular-nums;}
input[type=range]{
  width:100%; height:28px; background:transparent; -webkit-appearance:none; appearance:none;
  cursor:pointer;
}
input[type=range]::-webkit-slider-runnable-track{height:10px; border-radius:6px;}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none;
  width:22px; height:22px; border-radius:50%; margin-top:-6px;
  background:#fff; border:2px solid rgba(0,0,0,.3);
  box-shadow:0 2px 6px rgba(0,0,0,.4);
}
input[type=range]::-moz-range-track{height:10px; border-radius:6px;}
input[type=range]::-moz-range-thumb{
  width:20px; height:20px; border-radius:50%;
  background:#fff; border:2px solid rgba(0,0,0,.3);
}
#cv-hue::-webkit-slider-runnable-track{background:linear-gradient(90deg,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00);}
#cv-sat::-webkit-slider-runnable-track{background:var(--sat-track,linear-gradient(90deg,#555,#f00));}
#cv-bri::-webkit-slider-runnable-track{background:var(--bri-track,linear-gradient(90deg,#000,#f00));}
#cv-hue::-moz-range-track{background:linear-gradient(90deg,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00);}
#cv-sat::-moz-range-track{background:var(--sat-track,linear-gradient(90deg,#555,#f00));}
#cv-bri::-moz-range-track{background:var(--bri-track,linear-gradient(90deg,#000,#f00));}
.g-item.current .g-thumb{outline:2px solid var(--a1); outline-offset:2px;}
#hue::-webkit-slider-runnable-track{background:linear-gradient(90deg,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00);}
#hue::-moz-range-track{background:linear-gradient(90deg,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00);}
#sat::-webkit-slider-runnable-track{background:var(--sat-track,linear-gradient(90deg,#555,#f00));}
#sat::-moz-range-track{background:var(--sat-track,linear-gradient(90deg,#555,#f00));}
#bri::-webkit-slider-runnable-track{background:var(--bri-track,linear-gradient(90deg,#000,#f00));}
#bri::-moz-range-track{background:var(--bri-track,linear-gradient(90deg,#000,#f00));}
#size::-webkit-slider-runnable-track{background:rgba(255,255,255,.15);}
#size::-moz-range-track{background:rgba(255,255,255,.15);}
#crop-size::-webkit-slider-runnable-track{background:rgba(255,255,255,.15);}
#crop-size::-moz-range-track{background:rgba(255,255,255,.15);}
#size-sync{display:none; font-size:12px; color:var(--muted); margin-top:4px; font-style:italic;}
/* Size preview bubble */
#size-preview{
  position:fixed; left:50%; top:38%; transform:translate(-50%,-50%);
  display:none; flex-direction:column; align-items:center; gap:8px; z-index:70;
  pointer-events:none;
}
#size-preview.show{display:flex;}
#sp-circle{border-radius:50%; background:#ff2d2d; box-shadow:0 0 0 2px #000, 0 0 0 4px #fff;}
#sp-label{font-size:13px; color:var(--text); background:var(--panel); padding:4px 12px; border-radius:12px; border:1px solid var(--border);}
/* Gallery */
#gallery{
  position:fixed; inset:0; z-index:80; background:var(--bg);
  display:none; flex-direction:column;
}
#gallery.open{display:flex;}
#g-head{
  display:flex; align-items:center; gap:12px;
  padding:calc(env(safe-area-inset-top,0px) + 14px) 16px 10px;
}
#g-count{display:block; font-size:13px; color:var(--muted); font-weight:400; text-align:center; margin-top:6px;}
#g-profile{display:flex; flex-direction:column; align-items:center; padding:10px 0 18px;}
#gallery:not(.mode-mine):not(.mode-user) #g-profile{display:none;}
#gallery.searching #g-profile{display:none;}
/* Under a profile (or a list of names) the cards start right below it. */
#gallery.mode-mine #g-rows, #gallery.mode-user #g-rows, #gallery.searching #g-rows{margin-top:0;}
#g-namerow{display:flex; align-items:center; gap:8px; margin-top:10px;}
#g-pick{display:flex; align-items:center; gap:6px; flex-wrap:wrap; justify-content:center; margin:0 16px 10px; padding:8px 12px;
  border:1px solid var(--a1); border-radius:14px; font-size:13px; color:var(--text); background:rgba(34,211,238,.08);}
#g-pick[hidden]{display:none;}
#g-pick span{flex:1 1 100%; text-align:center;}
/* A profile picture: the drawn one, or the default smiley until there is one.
   Rounded square, never a circle -- it is a little canvas. */
.avatar{background:#1a1f2b center/cover no-repeat; border:1px solid var(--border); border-radius:28%; padding:0; flex:none;}
.avatar.big{width:96px; height:96px; cursor:pointer;}
.avatar.small{width:18px; height:18px; display:inline-block; vertical-align:-4px; margin-right:5px; border-radius:30%;}
.avatar.mid{width:40px; height:40px;}
#gallery.mode-user .avatar.big{cursor:default;}
#g-grid{flex:1; overflow-y:auto; padding:0 16px; display:flex; flex-direction:column;}
#g-rows{display:flex; flex-direction:column; gap:14px; padding-bottom:16px; margin-top:auto;}
.g-row{display:flex; flex-direction:row; gap:14px;}
.g-row.short{justify-content:flex-end;}   /* the top row, when the count is not a multiple of 3 */
.g-item{width:calc((100% - 28px)/3); cursor:pointer;}
.g-thumb{
  aspect-ratio:3/4; border-radius:12px; overflow:hidden; position:relative;
  border:1px solid var(--border); background:#222;
}
.g-thumb img{width:100%; height:100%; object-fit:cover; display:block;}
.g-title{font-size:12px; color:var(--muted); margin-top:6px; text-align:center; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
/* One options button tight in the top-left corner (Dex, 2026-10-08); a tap
   sends the card's buttons out of it to their own corners -- public top
   right, download bottom right, delete bottom left -- and a second tap
   folds them back in. They travel by left/top so the corners follow the
   card's size. */
.g-opt,.g-dl,.g-del,.g-pub{
  position:absolute; left:5px; top:5px; width:30px; height:30px; border-radius:9px;
  border:none; display:flex; align-items:center; justify-content:center; cursor:pointer;
  background:rgba(0,0,0,.6); color:#fff; padding:0;
}
.g-opt{z-index:2;}
.g-opt svg{width:17px; height:17px;}
.g-item.opts .g-opt{background:var(--grad);}
.g-dl,.g-del,.g-pub{opacity:0; transform:scale(.4); pointer-events:none;
  transition:left .24s cubic-bezier(.2,.8,.2,1), top .24s cubic-bezier(.2,.8,.2,1), opacity .18s, transform .24s cubic-bezier(.2,.8,.2,1);}
.g-item.opts .g-dl,.g-item.opts .g-del,.g-item.opts .g-pub{opacity:1; transform:none; pointer-events:auto;}
.g-item.opts .g-pub{left:calc(100% - 35px);}
.g-item.opts .g-dl{left:calc(100% - 35px); top:calc(100% - 35px);}
.g-item.opts .g-del{top:calc(100% - 35px);}
.g-dl svg,.g-del svg{width:15px; height:15px;}
@media (prefers-reduced-motion:reduce){ .g-dl,.g-del,.g-pub{transition:none;} }
/* Back and search, Public, you: the canvas toolbar's own pill (Dex,
   2026-10-08), with Public shrunk to sit in the middle like the tool toggle. */
#g-bar{
  flex:none; align-self:center; position:relative; z-index:2;
  display:flex; align-items:center; justify-content:space-between;
  width:calc(100vw - 20px); max-width:600px; box-sizing:border-box; height:var(--bar-h); padding:0 14px;
  background:var(--panel); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
  border:1px solid var(--border); border-radius:26px;
  margin:6px 0 calc(env(safe-area-inset-bottom,0px) + 8px);
}
/* Which build is running, so a report can say "on build a1b2c3". */
#g-head{position:relative; display:flex; align-items:center; gap:12px; padding:calc(env(safe-area-inset-top,0px) + 12px) 16px 4px; min-height:22px;}
#g-build{font-size:12px; letter-spacing:.04em; color:var(--muted); opacity:.6; flex:none; position:absolute; right:16px;}
.g-sq{width:52px; height:52px; border-radius:16px; flex:none; cursor:pointer;}
#g-back svg{width:24px; height:24px;}
#g-search-btn.on{background:rgba(255,255,255,.12);}
#g-tab-mine{width:44px; height:44px; border-radius:14px; cursor:pointer;}
/* Public <-> Mine, one button that says where it takes you. */
.g-wide{height:52px; border-radius:16px; background:var(--grad); border:none; color:#fff;
  font-size:19px; font-weight:800; letter-spacing:.01em; cursor:pointer; box-shadow:var(--glow); text-shadow:0 1px 2px rgba(0,0,0,.25);}
/* + in the middle: a new canvas, straight into it (Dex, 2026-10-08). */
#g-new{width:64px; height:46px; border-radius:15px; border:none; background:var(--grad); color:#fff; box-shadow:var(--glow);
  display:flex; align-items:center; justify-content:center; cursor:pointer;}
#g-new svg{width:24px; height:24px;}
/* The page's name, centred and 4pt up from 15px (Dex, 2026-10-08):
   "Public gallery" or "My gallery". */
#g-page{flex:1; font-size:20px; font-weight:800; letter-spacing:.01em; color:var(--text); text-align:center;
  padding:0 56px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
#g-tab-mine.on{outline:2px solid var(--a1); outline-offset:2px;}
/* Search: the chips and the pill, on the keyboard while it is up and above
   the bar when it is not (placeFind sets bottom). */
#g-find{position:fixed; left:0; right:0; bottom:0; z-index:3; display:none; flex-direction:column; align-items:center; gap:8px;
  padding:0 10px; pointer-events:none;
  /* It rides the keyboard (Dex, 2026-10-08): placeFind() moves it, and this
     is the glide -- about the keyboard's own speed and curve -- so the chips
     and the pill come up WITH it, one unit, rather than jumping ahead. */
  transition:bottom .26s cubic-bezier(.2,.8,.25,1);}
#g-find.still{transition:none;}
#gallery.searching #g-find{display:flex;}
#g-find > *{pointer-events:auto;}
#g-find-chips{display:flex; gap:6px; padding:4px; border-radius:16px; background:var(--panel); border:1px solid var(--border);
  backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);}
.g-chip{height:32px; padding:0 14px; border-radius:12px; border:none; background:none; color:var(--muted); font-size:14px; font-weight:700; cursor:pointer;}
.g-chip.on{background:var(--grad); color:#fff;}
#g-search-box{width:100%; max-width:600px; box-sizing:border-box; display:flex; align-items:center; gap:8px; height:48px; padding:0 6px 0 16px;
  background:var(--panel); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
  border:1px solid var(--a1); border-radius:24px; color:var(--muted);}
#g-search-box > svg{width:18px; height:18px; flex:none;}
#g-search{flex:1; min-width:0; background:none; border:none; outline:none; color:var(--text); font-size:16px;
  user-select:text; -webkit-user-select:text;}
#g-search::-webkit-search-cancel-button{display:none;}
#g-find-x{width:36px; height:36px; border-radius:50%; border:none; background:rgba(255,255,255,.08); color:var(--text);
  display:flex; align-items:center; justify-content:center; cursor:pointer; flex:none;}
#g-find-x svg{width:16px; height:16px;}
#gallery.searching #g-rows{padding-bottom:var(--find-h,120px);}
.g-sec{font-size:12px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); margin:6px 2px -4px;}
/* Select mode: no per-card buttons, a tick instead; the window floats. */
.g-item, .g-thumb img{-webkit-touch-callout:none; -webkit-user-select:none; user-select:none; -webkit-user-drag:none;}
/* A sweep reads the card under the finger, so the window must not be in the way. */
#gallery.sweeping #g-sel{pointer-events:none;}
.g-thumb img{pointer-events:none;}
#g-grid{touch-action:pan-y;}
.g-check{position:absolute; top:6px; right:6px; width:24px; height:24px; border-radius:50%; border:2px solid #fff;
  background:rgba(0,0,0,.35); display:none; box-sizing:border-box;}
#gallery.selecting .g-check{display:block;}
#gallery.selecting .g-dl, #gallery.selecting .g-del, #gallery.selecting .g-pub, #gallery.selecting .g-opt{display:none;}
#gallery.selecting .g-item.current .g-thumb{outline:none;}
.g-item.sel .g-thumb{outline:3px solid var(--a1); outline-offset:-3px;}
.g-item.sel .g-thumb img{opacity:.72;}
.g-item.sel .g-check{background:var(--a1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center/16px no-repeat; border-color:var(--a1);}
#g-sel{position:fixed; z-index:4; width:208px; display:none; padding:6px 10px 10px; box-sizing:border-box;
  background:var(--panel); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
  border:1px solid var(--border); border-radius:20px; box-shadow:0 10px 30px rgba(0,0,0,.45);}
#g-sel.open{display:block;}
#g-sel-head{display:flex; align-items:center; gap:6px; height:38px; cursor:grab; touch-action:none; -webkit-user-select:none; user-select:none;}
#g-sel-head::before{content:''; position:absolute; left:50%; top:5px; width:28px; height:4px; margin-left:-14px; border-radius:2px; background:var(--border);}
#g-sel-title{flex:1; min-width:0; font-size:15px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; padding-left:4px;}
#g-sel-x{width:32px; height:32px; border-radius:50%; border:none; background:rgba(255,255,255,.08); color:var(--text);
  display:flex; align-items:center; justify-content:center; cursor:pointer; flex:none;}
#g-sel-x svg{width:15px; height:15px;}
#g-sel-grid{display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:4px;}
.sel-btn{display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; height:64px; border-radius:14px;
  border:1px solid var(--border); background:rgba(255,255,255,.05); color:var(--text); font-size:12px; font-weight:600; cursor:pointer;}
.sel-btn svg{width:22px; height:22px;}
.sel-btn.danger{color:#ff6b6b;}
.sel-btn:disabled{opacity:.3; cursor:default;}
/* The crop sheet */
#crop{position:fixed; inset:0; z-index:89; background:rgba(0,0,0,.7); display:none; align-items:center; justify-content:center; padding:20px;}
#crop.open{display:flex;}
#crop-card{background:var(--panel); border:1px solid var(--border); border-radius:18px; padding:18px; width:100%; max-width:360px;}
#crop-stage{position:relative; margin:8px auto 12px; touch-action:none; width:fit-content;}
#crop-cv{display:block; border-radius:8px; max-width:100%;}
#crop-box{position:absolute; border:2px solid #fff; border-radius:22%; box-shadow:0 0 0 9999px rgba(0,0,0,.55); cursor:move; touch-action:none;}
#crop-stage{overflow:hidden; border-radius:8px;}
#crop-card .mrow{display:flex; gap:10px; margin:0;}
#crop-card .a-text{margin:6px 0 14px;}
.by-link{background:none; border:none; color:var(--muted); font:inherit; font-size:13px; cursor:pointer; padding:2px 4px;}
.g-by{cursor:pointer;}
/* Search results: one row per artist. */
.g-user{display:flex; align-items:center; gap:12px; padding:10px 6px; border-bottom:1px solid var(--border); cursor:pointer;
  background:none; border-left:none; border-right:none; border-top:none; color:var(--text); font-size:16px; font-weight:600; width:100%; text-align:left;}
#a-rename-row{display:flex; align-items:center; gap:8px; margin-bottom:4px;}
#a-rename-row .a-field{margin:0; flex:1; min-width:0;}
#a-rename-row .mbtn{flex:none; padding:12px 16px;}
.a-at{font-size:17px; color:var(--muted); font-weight:700;}
/* Confirm modal */
#modal{
  position:fixed; inset:0; z-index:90; background:rgba(0,0,0,.6);
  display:none; align-items:center; justify-content:center; padding:24px;
}
#modal.open{display:flex;}
/* A fifth of the screen below centre, nearer the thumb (Dex, 2026-10-08),
   but never closer than 24px to the bottom on a short screen. */
#modal-card{
  transform:translateY(min(20vh, calc(50vh - 50% - 24px)));
  background:var(--panel); border:1px solid var(--border); border-radius:18px;
  padding:22px; width:100%; max-width:320px; backdrop-filter:blur(18px);
}
#m-title{font-size:17px; font-weight:700; margin-bottom:8px;}
#m-text{font-size:14px; color:var(--muted); margin-bottom:18px;}
#modal-card .mrow{display:flex; gap:10px; margin:0;}
.mbtn{
  flex:1; padding:12px; border-radius:12px; border:1px solid var(--border);
  background:transparent; color:var(--text); font-size:15px; font-weight:600; cursor:pointer;
}
.mbtn.danger{background:var(--danger); border-color:var(--danger); color:#fff;}
/* Toast */
/* Under the title, centred (Dex, 2026-10-08): toast() sets top from the
   title's box. Over the gallery it sits low again, above its bar. */
#toast{
  position:fixed; left:50%; top:70px; transform:translateX(-50%); text-align:center; line-height:1.35;
  background:var(--panel); border:1px solid var(--border); color:var(--text);
  padding:10px 20px; border-radius:20px; font-size:14px; z-index:100;
  opacity:0; pointer-events:none; transition:opacity .25s;
  white-space:nowrap;
}
#toast.show{opacity:1;}
/* Something that did not happen: red, at the top like the rest. */
#toast.err{background:#3a0f14; border-color:var(--danger); color:#ffd9dc;}
#toast.err small{color:#ffb3b9;}
/* A control held down: its name and a few words, centred above the bar that
   is up (placed by showHoldTip()). Holding is not tapping. */
#hold-tip{position:fixed; left:50%; transform:translateX(-50%); z-index:110; text-align:center; line-height:1.3;
  background:var(--panel); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
  border:1px solid var(--border); border-radius:14px; padding:8px 16px; pointer-events:none; white-space:nowrap;
  color:var(--text);}
#hold-tip[hidden]{display:none;}
#hold-tip b{display:block; font-size:15px; font-weight:700;}
#hold-tip small{display:block; font-size:12.5px; font-weight:500; color:var(--muted);}
.tbtn, #canvas-swatch, #top-lock{-webkit-touch-callout:none;}
/* Dark text on the green: white on #22b45a read poorly (Dex, 2026-10-08). */
.mbtn.go{background:#2fd06a; border-color:#2fd06a; color:#06240f;}
/* Asking a second time on the button itself: "You sure?" */
.mbtn.danger.armed{box-shadow:0 0 0 3px rgba(255,69,58,.35); animation:armPulse .9s ease-in-out infinite alternate;}
@keyframes armPulse{to{box-shadow:0 0 0 6px rgba(255,69,58,.12)}}
@media (prefers-reduced-motion: reduce){.mbtn.danger.armed{animation:none;}}
/* Embed mode: full-bleed for the portfolio overlay */
body.embed #topbar{padding-top:8px;}
body.embed #toolbar{margin-bottom:8px;}

/* ---- the shared gallery: account, card toggle, reactions, viewer ---- */
.g-account{background:var(--panel); border:1px solid var(--border); color:var(--text); font-size:13px; font-weight:600;
  padding:7px 12px; border-radius:12px; cursor:pointer; max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.g-account.signed{color:var(--a1); background:none; border:none; font-size:17px; font-weight:700; padding:4px 2px;
  display:flex; align-items:center; gap:8px; max-width:240px;}
/* The edit button to the right of the @tag. */
.g-account.signed::after{content:''; width:30px; height:30px; flex:none; border-radius:10px; border:1px solid var(--border);
  background:var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f2f4f8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20 H8 L19 9 L15 5 L4 16 Z'/%3E%3Cpath d='M13 7 L17 11'/%3E%3C/svg%3E") center/16px no-repeat;}
#gallery.mode-user #g-account{display:none;}
#g-user-name{font-size:17px; font-weight:700;}
.g-pub svg{width:15px; height:15px;}
.g-pub.on{background:var(--grad); color:#fff;}
.g-pub:disabled{opacity:.5;}
.g-by{font-size:11px; color:var(--muted); text-align:center; opacity:.8; margin-top:1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.g-react{display:flex; justify-content:center; gap:6px; margin-top:6px;}
.g-rx{display:flex; align-items:center; gap:4px; background:var(--panel); border:1px solid var(--border); color:var(--text);
  border-radius:12px; padding:4px 8px; font-size:13px; cursor:pointer;}
.g-rx b{font-weight:600; font-variant-numeric:tabular-nums;}
.g-rx.on{border-color:var(--a1); background:rgba(34,211,238,.14);}
.g-empty{color:var(--muted); font-size:15px; text-align:center; padding:40px 20px; line-height:1.5;}
/* The viewer: an overlay over the grid. Title up top, nothing to press in
   the top half; the drawing sits low, the artist under it, and one control
   bar at the bottom. */
#viewer{position:fixed; inset:0; z-index:85; background:rgba(5,6,10,.94); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px);
  display:none; flex-direction:column; touch-action:none; overscroll-behavior:none;}
#viewer.open{display:flex;}
#v-title{padding:calc(env(safe-area-inset-top,0px) + 18px) 20px 6px; font-size:22px; font-weight:800; text-align:center;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
#v-stage{flex:1; min-height:0; display:flex; align-items:flex-end; justify-content:center; padding:10px 18px 6px; overflow:hidden;}
#v-img{max-width:100%; max-height:100%; border-radius:16px; box-shadow:0 14px 44px rgba(0,0,0,.6); will-change:transform; user-select:none; -webkit-user-drag:none;}
.v-artist{display:flex; align-items:center; justify-content:center; gap:12px; margin:12px auto 4px; max-width:calc(100% - 40px);
  background:none; border:none; color:var(--text); font-size:21px; font-weight:800; cursor:pointer; padding:4px 8px;}
.v-artist .avatar{width:48px; height:48px;}
.v-artist .tag{min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
#v-bar{display:flex; align-items:center; gap:14px; padding:12px 16px calc(env(safe-area-inset-bottom,0px) + 16px);}
.v-btn{background:var(--panel); border:1px solid var(--border); color:var(--text); display:flex; align-items:center; justify-content:center;}
.v-btn svg{width:24px; height:24px;}
#v-bar .g-react{flex:1; display:flex; justify-content:center; margin:0;}
#v-acts{position:absolute; right:16px; bottom:calc(env(safe-area-inset-bottom,0px) + 84px); display:flex; flex-direction:column; gap:2px;
  background:var(--panel); border:1px solid var(--border); border-radius:14px; padding:6px;}
#v-acts[hidden]{display:none;}
#v-acts .v-link{text-decoration:none; color:var(--text); font-size:15px; padding:10px 14px; text-align:left;}
/* Poop | fire: one pill split in two. Grey until you choose one; the one
   you chose takes its colour and shows its count. The icons are the site's
   own (styles.css, the prefs votes), as masks so they take any colour. */
.rx-pill{display:flex; height:52px; border-radius:26px; overflow:hidden; border:1px solid var(--border); background:var(--panel);}
.rx-pill .g-rx{display:flex; align-items:center; justify-content:center; gap:8px; min-width:86px; padding:0 18px; border:none; border-radius:0;
  background:none; color:var(--text); font-size:18px; font-weight:800; cursor:pointer;}
.rx-pill .g-rx + .g-rx{border-left:1px solid var(--border);}
.rx-ico{width:26px; height:26px; display:block; background:#5d6577; -webkit-mask:var(--icon) center/contain no-repeat; mask:var(--icon) center/contain no-repeat; transition:background .2s, transform .2s;}
.rx-ico[data-icon="fire"]{--icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M13.1 1.6c.5 2.7-.5 4.4-1.9 5.9-1.5 1.6-3.3 3-3.3 5.6 0 .9.2 1.7.6 2.4-1-.5-1.8-1.4-2.2-2.5-1 1.3-1.6 2.9-1.6 4.6 0 3.4 3.3 6.1 7.3 6.1s7.3-2.7 7.3-6.1c0-2.9-1.3-4.9-2.7-6.7-.5 1.1-1.3 1.9-2.3 2.2 1.2-3.7-.1-8.2-1.2-11.5Z'/%3E%3C/svg%3E");}
.rx-ico[data-icon="poop"]{--icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='%23fff'%3E%3Cellipse cx='12' cy='18.6' rx='10.4' ry='3.1'/%3E%3Cellipse cx='12' cy='14.2' rx='8.1' ry='2.9'/%3E%3Cellipse cx='12' cy='9.4' rx='5.3' ry='2.7'/%3E%3Cpath d='M12.4 7.1c-1.5 0-2.5-.8-2.5-1.9 0-1.6 2-1.9 2-3.2 0-.4-.1-.8-.4-1.1 2.2.4 3.8 1.9 3.8 3.6 0 1.5-1.2 2.6-2.9 2.6Z'/%3E%3C/g%3E%3C/svg%3E");}
.g-rx.on .rx-ico[data-icon="fire"]{background:linear-gradient(180deg,#ffc247,#ff6a1f 60%,#f12f6c); transform:scale(1.12);}
.g-rx.on .rx-ico[data-icon="poop"]{background:linear-gradient(180deg,#c8905a,#8a5a2e); transform:scale(1.12);}
.g-rx b{font-weight:800; font-variant-numeric:tabular-nums;}
.g-rx b:empty{display:none;}
.v-link{background:none; border:none; color:var(--muted); font-size:13px; text-decoration:underline; cursor:pointer; padding:6px;}
.v-x{position:absolute; top:calc(env(safe-area-inset-top,0px) + 12px); right:14px; width:38px; height:38px; border-radius:50%;
  border:1px solid var(--border); background:var(--panel); color:var(--text); display:flex; align-items:center; justify-content:center; cursor:pointer; z-index:2;}
.v-x svg{width:16px; height:16px;}
#account{position:fixed; inset:0; z-index:88; background:rgba(0,0,0,.6); display:none; align-items:center; justify-content:center; padding:24px;}
#account.open{display:flex;}
#account-card{position:relative; background:var(--panel); border:1px solid var(--border); border-radius:18px; padding:22px; width:100%; max-width:340px; backdrop-filter:blur(18px);}
#account-card .v-x{position:absolute; top:10px; right:10px; width:32px; height:32px;}
.a-title{font-size:17px; font-weight:700; margin:2px 40px 8px 0;}
.a-text{font-size:13px; color:var(--muted); line-height:1.45; margin-bottom:14px;}
.a-danger-zone{margin:18px 0 10px;}
.a-field{width:100%; background:rgba(255,255,255,.05); border:1px solid var(--border); border-radius:12px; color:var(--text);
  font-size:16px; padding:12px 14px; margin-bottom:10px; outline:none; user-select:text; -webkit-user-select:text;}
.a-field:focus{border-color:var(--a1);}
.a-msg{min-height:18px; font-size:13px; color:var(--danger); margin-bottom:8px;}
#account-card .mrow{display:flex; gap:10px;}
.mbtn.primary{background:var(--grad); border-color:transparent; color:#fff;}
/* Sign in: the providers' own buttons, one size, logo on the left. Google's is
   white with its four-colour G, Discord's is its blurple with the white mark. */
.a-center{text-align:center; margin-left:0; margin-right:0;}
#account-card .a-title.a-center{margin:2px 34px 8px;}
/* Signing in: the sheet becomes a spinner until the account and its canvases
   are on screen, and an error with Try again if that fails. */
.a-spin{width:40px; height:40px; margin:10px auto 14px; border-radius:50%;
  background:conic-gradient(from 0deg, transparent 0 25%, var(--a3), var(--a2), var(--a1));
  -webkit-mask:radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
          mask:radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  animation:aSpin .8s linear infinite;}
.a-spin[hidden]{display:none;}
@keyframes aSpin{to{transform:rotate(360deg);}}
@media (prefers-reduced-motion: reduce){ .a-spin{animation-duration:2.4s;} }
#a-busy .a-text:empty{display:none;}
#a-busy-row{margin-top:6px;}
#a-busy-row .mbtn{flex:1;}
.sso{display:flex; align-items:center; justify-content:center; gap:12px; width:100%; height:48px; border-radius:12px;
  font-size:15px; font-weight:600; text-decoration:none; margin-bottom:10px; cursor:pointer; position:relative;}
.sso svg{width:20px; height:20px; position:absolute; left:16px;}
.sso-google{background:#fff; color:#1f1f1f; border:1px solid #dadce0;}
.sso-google:active{background:#f1f3f4;}
.sso-discord{background:#5865f2; color:#fff; border:1px solid #5865f2;}
.sso-discord svg{width:22px; height:22px;}
.sso-discord:active{background:#4752c4;}
.a-more{display:block; margin:4px auto 0; background:none; border:none; color:var(--muted); font-size:13px;
  text-decoration:underline; cursor:pointer; padding:8px;}
#a-pw{margin-top:12px; padding-top:14px; border-top:1px solid var(--border);}
.a-full{width:100%; flex:none;}
#a-others .mbtn{margin-bottom:14px;}

/* ---- the public grid (Dex, 2026-10-08): two across, and a tile is only the
   drawing -- the artist and the fire count ride on it, nothing hangs below. */
.g-row.two .g-item{width:calc((100% - 14px)/2);}
.p-item .g-thumb{border-radius:16px;}
.p-by{position:absolute; left:0; right:0; bottom:0; display:flex; align-items:center; gap:9px; padding:22px 10px 9px;
  background:linear-gradient(transparent, rgba(0,0,0,.72)); color:#fff; font-size:17px; font-weight:800; cursor:pointer;}
.p-by .avatar{width:36px; height:36px; border-color:rgba(255,255,255,.25);}
.p-by .tag{min-width:0; flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; text-shadow:0 1px 3px rgba(0,0,0,.6);}
.p-fire{position:absolute; top:8px; right:8px; display:flex; align-items:center; gap:4px; padding:4px 9px 4px 6px; border-radius:14px;
  background:rgba(0,0,0,.55); color:#fff; font-size:14px; font-weight:800; font-variant-numeric:tabular-nums;}
.p-fire .rx-ico{width:17px; height:17px; background:linear-gradient(180deg,#ffc247,#ff6a1f 60%,#f12f6c);}
#toast.low{top:auto; bottom:calc(env(safe-area-inset-bottom,0px) + 96px);}
#toast small{display:block; font-size:12.5px; color:var(--muted); font-weight:500;}
#toast b{font-weight:700;}

/* Your own drawing in Public: the globe to take it back (Dex, 2026-10-08). */
.p-item .g-pub{opacity:1; transform:none; pointer-events:auto; left:8px; top:8px; z-index:2;}
#g-prof{order:1;} #g-bar{order:2;}
/* Someone's tag folds into their picture; a tap on the picture shows it. */
.p-by{pointer-events:none;}
.p-by > *{pointer-events:auto;}
.p-by .tag{max-width:0; opacity:0; transition:max-width .22s ease, opacity .18s; flex:0 1 auto; cursor:pointer;}
.p-by.open .tag{max-width:100%; opacity:1;}
.p-by .avatar{cursor:pointer;}
.p-slot:empty{display:none;}
/* The profile bar: a second pill over the gallery's own. */
#g-prof{flex:none; align-self:center; display:flex; align-items:center; justify-content:space-evenly; gap:6px;
  width:calc(100vw - 20px); max-width:600px; box-sizing:border-box; height:var(--bar-h); padding:0 10px; margin-top:6px;
  background:var(--panel); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
  border:1px solid var(--border); border-radius:26px;}
#g-prof[hidden]{display:none;}
.pf-btn{flex:1; min-width:0; height:54px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  border:none; border-radius:14px; background:none; color:var(--text); font-size:11px; font-weight:700; cursor:pointer;}
.pf-btn svg{width:22px; height:22px;}
.pf-btn.danger{color:#ff6b6b;}
.pf-btn[hidden]{display:none;}
#g-prof-slot:empty, #v-slot:empty{display:none;}
