/* ---------- 12d. In a pocket: a phone's own layout, and a tablet's (app/js/pocket.js) ----------
   html.pocket: a phone or a tablet (a touch screen with no mouse, or an iPad; index.html). At the top only where you
   are; at the bottom one bar at a time, in the dock's raised paper: the bottom bar, or the rail, or a sheet, or
   Unsorted's drawer. On a tablet they stand in the middle, no wider than on a phone on its side. */
#pkbar, #pksheet, #pkveil, #pktip { display: none; }

/* The top: Back, the path, and Settings' button. The dock's buttons are in the bottom bar now; the open board's
   name is the path's last; "Get the app" is what this is. */
html.pocket .bar > .dock, html.pocket #btile, html.pocket .cx-get { display: none !important; }
html.pocket .bar > .crumbs { max-width: calc(100% - 96px); }
html.pocket .cx-pill { top: calc(env(safe-area-inset-top, 0px) + 10px) !important; }
html.pocket .cx-pill .cx-acct-btn { width: 36px; height: 36px; padding: 0; justify-content: center; position: relative; border-radius: 10px; }
html.pocket .cx-pill .cx-acct-btn .cx-lab { display: none; }
html.pocket .cx-pill .cx-acct-btn svg { width: 17px; height: 17px; }
html.pocket .cx-pill .cx-acct-btn .cx-dot { position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; box-shadow: 0 0 0 2px var(--canvas); }
html.pocket .cx-pill .cx-inbox-btn .cx-ib-count { position: absolute; top: -4px; right: -4px; margin: 0; }

/* The welcome (Draw a shape, get a thing): in the room between the top and the bottom bar, its middle in that room's,
   never under either. Where that room is short (a small phone, a phone on its side) it gives up first the drawing
   hand, then the gaps, so Start with a template and Start with AI stay in reach (Jarred, 2026-10-27). Its box stays its
   words' own size: the axes leave a gap round it (brand.js, side/axes.js). The room: 58px under the top, 88px over the
   bottom (52 and 64 on its side). */
html.pocket #empty {
  top: calc(50% + (env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 30px) / 2); transform: translate(-50%, -50%);
}
@media (max-height: 640px) {
  html.pocket #empty .e-demo { display: none; }
  html.pocket #empty strong { font-size: 25px; }
  html.pocket #empty :is(.e-tut, .e-board .e-preset) { margin-top: 18px; }
  html.pocket #empty .e-root .e-start { margin-top: 18px; }
  html.pocket #empty .e-start { height: 34px; }
}
@media (max-height: 500px) {
  html.pocket #empty { top: calc(50% + (env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 12px) / 2); width: min(560px, calc(100% - 32px)); }
  html.pocket #empty strong { font-size: 22px; }
  html.pocket #empty p span { margin-top: 6px; font-size: 15px; line-height: 1.4; }
  html.pocket #empty :is(.e-tut, .e-board .e-preset) { margin-top: 12px; }
  html.pocket #empty .e-root .e-start { margin-top: 8px; }
  html.pocket #empty .e-or { margin: 4px 0 2px; }
  html.pocket #empty .e-start { height: 32px; }
}

/* The bottom bar: five keys of a thumb's size, each its glyph over its name; Add, in the middle, inked. */
html.pocket #pkbar {
  position: fixed; z-index: 12; left: 0; right: 0; width: max-content; max-width: calc(100% - 24px); margin-inline: auto;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  display: flex; align-items: center; gap: 2px; padding: 5px; box-sizing: border-box; border-radius: 16px;
  background: var(--glass); box-shadow: var(--glass-sh);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: opacity 180ms ease-out, translate 260ms cubic-bezier(.2, .8, .2, 1), visibility 0s;
}
/* Something else has the bottom (the rail, a sheet, the drawer), or a hand is busy on the canvas: it steps down out of
   the way. */
html.pocket #pkbar.pk-off { opacity: 0; translate: 0 calc(100% + 24px); visibility: hidden; pointer-events: none;
  transition: opacity 140ms ease-in, translate 200ms ease-in, visibility 0s linear 200ms; }
html.pocket body:is(.moving, .drawing, .sizing, .marking) #pkbar { opacity: .15; pointer-events: none; transition-duration: 150ms; }
.pk-b {
  position: relative; flex: none; display: grid; justify-items: center; align-content: center; gap: 1px; width: 60px; height: 56px; padding: 0;
  border: 0; border-radius: 11px; background: transparent; color: var(--ink-2); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color 120ms ease-out, box-shadow 120ms ease-out, color 120ms ease-out;
}
.pk-b[hidden] { display: none; }
.pk-b > svg { width: 22px; height: 22px; padding: 6px; box-sizing: content-box; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.pk-b .pk-l { font: 500 10.5px/12px var(--f-ui); letter-spacing: .005em; white-space: nowrap; }
.pk-b:active, .pk-b[aria-pressed="true"] { color: var(--ink); background: var(--press-bg); box-shadow: var(--press); }
.pk-b:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
/* The side view's glyph: layers along Z, the last one in the depth colour (it is where Z is). */
.pk-side .pk-z { stroke: var(--z); }
.pk-ai .g-z { stroke: var(--z); }
.pk-ai .g-o { fill: currentColor; stroke: none; }
.pk-plus {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--ink); color: var(--canvas); box-shadow: 0 4px 10px -4px var(--drop-1);
}
.pk-plus svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.pk-add:active .pk-plus { scale: .94; }
.pk-add:active { background: transparent; box-shadow: none; }
/* How many wait in Unsorted: a small count at the glyph's corner. */
.pk-n {
  position: absolute; top: 5px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box; border-radius: 8px;
  font: 600 9.5px/16px var(--f-mono); text-align: center; color: var(--canvas); background: var(--ink-2);
}
.pk-n:empty { display: none; }

/* A small phone: the keys share what there is; a phone on its side: glyphs alone, a thumb's size still. */
@media (max-width: 360px) { .pk-b { width: calc((100vw - 42px) / 5); } }
@media (max-height: 500px) {
  html.pocket #pkbar { bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); padding: 4px; border-radius: 14px; }
  .pk-b { width: 52px; height: 44px; }
  .pk-b .pk-l { display: none; }
  .pk-plus { width: 32px; height: 32px; }
  .pk-n { top: 3px; }
}

/* The sheets (Add, More): from the bottom, over a veil. */
html.pocket #pkveil { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(22, 27, 29, .18); }
html.pocket #pkveil[hidden], html.pocket #pksheet[hidden] { display: none; }
html.pocket #pksheet {
  display: flex; flex-direction: column; position: fixed; z-index: 31; left: 8px; right: 8px; bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  max-height: calc(100% - env(safe-area-inset-top, 0px) - 60px); padding: 0 6px 10px; box-sizing: border-box; border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--pop), var(--edge);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); overflow: hidden; touch-action: none;
}
.pk-grab { flex: none; width: 36px; height: 4px; margin: 8px auto 2px; border-radius: 2px; background: var(--rule-2); }
.pk-hd { flex: none; display: flex; align-items: center; justify-content: space-between; height: 44px; padding: 0 4px 0 14px; }
.pk-t { margin: 0; font: 500 22px/28px var(--f-display); letter-spacing: -.012em; color: var(--ink); font-optical-sizing: auto; }
.pk-x {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  color: var(--ink-2); background: color-mix(in srgb, var(--ink) 6%, transparent);
}
.pk-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.pk-x:active { background: color-mix(in srgb, var(--ink) 12%, transparent); }
.pk-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 4px 4px 0; }
/* Add: four across, each thing's glyph on a raised key, its name under it. */
.pk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pk-tile {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 7px; height: 78px; padding: 0; border: 0; border-radius: 13px; cursor: pointer;
  color: var(--ink-2); background: transparent; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
  transition: background-color 120ms ease-out, box-shadow 120ms ease-out;
}
/* Picture (a label): its file input fills it, unseen, so the finger lands on the input (pocket.js, pkPicked). */
.pk-tile:has(> .pick-in:focus-visible) { outline: 2px solid var(--ink); outline-offset: -2px; }
.pk-tile svg {
  width: 26px; height: 26px; padding: 9px; border-radius: 11px; box-sizing: content-box; overflow: visible;
  fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round;
  background: var(--canvas); box-shadow: var(--raise-sm), var(--edge);
}
.pk-tile[data-t="ai"] svg .g-z { stroke: var(--z); }
.pk-tile[data-t="ai"] svg .g-o { fill: currentColor; stroke: none; }
.pk-tile svg [fill="currentColor"] { fill: currentColor; stroke: none; }
.pk-tile span { font: 500 11.5px/14px var(--f-ui); color: var(--ink); white-space: nowrap; }
.pk-tile.pk-drag { touch-action: none; }      /* a finger on it drags its thing out (pocket.js, section 5b), never scrolls the sheet */
.pk-tile:active { background: var(--press-bg); }
.pk-tile:active svg { box-shadow: var(--press); }
.pk-foot { margin: 12px 10px 4px; font: 400 13px/18px var(--f-ui); color: var(--ink-3); text-align: center; text-wrap: pretty; }
/* More: rows. A choice of a few is a segmented control; on and off, a switch; somewhere to go, a chevron. */
.pk-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 52px; padding: 6px 10px;
  box-sizing: border-box; border: 0; border-radius: 12px; background: transparent; color: var(--ink); text-align: left; font: 500 15px/20px var(--f-ui);
}
button.pk-row { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button.pk-row:active { background: var(--press-bg); }
.pk-rl { display: grid; gap: 1px; min-width: 0; }
.pk-rl small { font: 400 12px/16px var(--f-ui); color: var(--ink-3); }
.pk-seg { flex: none; display: flex; padding: 3px; border-radius: 10px; background: var(--canvas); box-shadow: var(--sunk); }
.pk-seg > button {
  height: 32px; min-width: 58px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2);
  font: 500 13px/32px var(--f-ui); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color 140ms ease-out, color 140ms ease-out;
}
.pk-seg > button[aria-checked="true"] { color: var(--ink); background: var(--surface); box-shadow: var(--raise-sm); }
.pk-sw > i {
  flex: none; position: relative; width: 46px; height: 28px; border-radius: 14px; background: var(--rule-2);
  transition: background-color 180ms ease-out;
}
.pk-sw > i::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface);
  box-shadow: 0 1px 3px rgba(22, 27, 29, .25); transition: translate 200ms cubic-bezier(.2, .8, .2, 1);
}
.pk-sw[aria-checked="true"] > i { background: var(--ink); }
.pk-sw[aria-checked="true"] > i::after { translate: 18px 0; }
.pk-go svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--ink-3); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pk-sep { height: 1px; margin: 6px 10px; background: var(--rule); }
/* A phone on its side, or a tablet: the sheet no wider than 620 px, in the middle, and Add six across (lower, on its
   side). (After the sheet's own rules, which they change.) */
@media (max-height: 500px), (min-width: 700px) {
  html.pocket #pksheet { left: 0; right: 0; width: min(620px, calc(100% - 16px)); margin-inline: auto; }
  .pk-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (max-height: 500px) { .pk-tile { height: 70px; } }

/* A short word at the bottom (the turn's first time; what two fingers tapped together undid). */
html.pocket #pktip {
  display: block; position: fixed; z-index: 40; left: 16px; right: 16px; width: max-content; max-width: calc(100% - 32px); margin-inline: auto;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); padding: 10px 14px; box-sizing: border-box; border-radius: 12px;
  background: var(--ink); color: var(--canvas); box-shadow: var(--raise); font: 500 13px/18px var(--f-ui); text-align: center; pointer-events: none;
}
html.pocket #pktip[hidden] { display: none; }
html.pocket body.shaping #pktip { bottom: calc(env(safe-area-inset-bottom, 0px) + 28px + var(--sd-h, 89px)); }   /* over Draw's dock */
html.pocket #pktip.on { animation: pktip 220ms ease-out both; }
@keyframes pktip { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }

/* The rail stands where the bottom bar does, one bar at a time. */
html.pocket #insp { bottom: calc(max(env(safe-area-inset-bottom, 0px), var(--kb, 0px)) + 12px); }
html.pocket #guide { display: none !important; }
/* The Undo pill sits where the bar was (it has stepped aside, or the pill is above it: touch.js measures). */
html.pocket #tundo { bottom: calc(max(env(safe-area-inset-bottom, 0px), var(--kb, 0px)) + 84px); }

/* Unsorted, a drawer along the bottom (section 17d): the column in the middle of a sheet as wide as the screen, its
   head the handle, with a grip. Lowered, it is not drawn. Its own box reaches the screen's edges (it starts at the
   left one, usPlace, and its padding, --us-l and --us-r in its own px, puts its cards where usAt says), so the sheet
   is drawn inside it:
   WebKit clips a moving layer's clip-path to the layer's own box, and a sheet drawn past it was as narrow as the
   column on an iPhone. */
html.pocket #objs > .obj.column.us, html.pocket #usv {
  --pk-us-bg: color-mix(in srgb, var(--surface) 62%, var(--canvas));
  box-sizing: content-box; padding-left: var(--us-l, 0px); padding-right: var(--us-r, 0px);
  min-height: var(--us-h, 0px) !important; border-radius: 0; background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
  clip-path: inset(0);
}
html.pocket #objs > .obj.column.us::before, html.pocket #usv::before {
  content: ""; position: absolute; z-index: -1; top: 0; bottom: -40px; left: 0; right: 0;
  border-radius: 20px 20px 0 0; background: var(--pk-us-bg);
  box-shadow: inset 0 1px 0 var(--rule), 0 -14px 30px -18px rgba(22, 27, 29, .4);
}
html.pocket #objs > .obj.column.us > .chead, html.pocket #usv > .chead {
  height: 56px; padding: 12px 6px 0; border-radius: 0; background: transparent; box-shadow: none; cursor: grab; touch-action: none;
}
html.pocket #objs > .obj.column.us > .chead::before, html.pocket #usv > .chead::before {      /* the grip, and the sheet behind the head */
  content: ""; position: absolute; z-index: -1; top: 0; bottom: 0; left: calc(-1 * var(--us-l, 0px)); right: calc(-1 * var(--us-r, 0px));
  border-radius: 20px 20px 0 0;
  background: radial-gradient(circle, var(--rule-2) 1.6px, transparent 2.2px) calc(50% - 16px) 6px / 4px 4px no-repeat,
    radial-gradient(circle, var(--rule-2) 1.6px, transparent 2.2px) calc(50% + 16px) 6px / 4px 4px no-repeat,
    linear-gradient(var(--rule-2), var(--rule-2)) 50% 6px / 32px 4px no-repeat, var(--pk-us-bg);
}
html.pocket #objs > .obj.column.us > .chead::after, html.pocket #usv > .chead::after { rotate: 45deg; }      /* its arrow points down: lower it */
html.pocket #objs[data-us="min"] > .obj.column.us, html.pocket #usv.min { visibility: hidden; pointer-events: none; }
html.pocket body.moving #objs[data-us="on"] > .obj.column.us { clip-path: none; }
/* A card carried up out of it: the rest of it fades away until the card is let go, and then it is lowered. */
html.pocket #objs > .obj.column.us.us-sink::before, html.pocket #objs > .obj.column.us.us-sink > .chead, html.pocket #objs > .obj.column.us.us-sink > .cstack > :not(.held) {
  opacity: 0; transition: opacity 180ms ease-out;
}
/* An iPad on its side (html.us-row, usRow in section 17d): a shelf along the bottom, the screen's whole width (--us-w),
   its cards in one row from the left (USR.GAP apart, USR.PAD from its ends), each as wide as in a column and no taller
   than the shelf may be (--us-ch; the shelf is as tall as its tallest card, usRowH); a slide across scrolls them. A drop between two cards shows an upright line. */
html.us-row #objs > .obj.column.us, html.us-row #usv { width: var(--us-w, 100vw) !important; }
html.us-row #objs > .obj.column.us > .chead, html.us-row #usv > .chead { padding: 12px 18px 0 16px; }
html.us-row #objs > .obj.column.us > .cstack, html.us-row #usv > .cstack {
  flex-direction: row; align-items: flex-start; gap: 12px; padding: 4px 16px 16px;
}
html.us-row #objs > .obj.column.us > .cstack:empty, html.us-row #usv > .cstack:empty { margin: 4px 16px 16px; padding: 0; min-height: 96px; }
html.us-row #objs > .obj.column.us > .cstack > *, html.us-row #usv > .cstack > * {
  width: 248px !important; max-height: var(--us-ch, 220px) !important; overflow: hidden; align-self: flex-start;
}
html.us-row #objs > .obj.column.us > .cstack > .obj.board[data-view="icon"], html.us-row #usv > .cstack > .obj.board[data-view="icon"] { width: 124px !important; }
html.us-row #objs > .obj.column.us > .cstack > .obj.image, html.us-row #usv > .cstack > .obj.image {
  width: min(248px, calc(var(--us-ch, 220px) * var(--ar, 1))) !important;
}
html.us-row #objs > .obj.column.us > .cline.up { left: 0; right: auto; width: 2px; height: 0; margin: 0 0 0 -1px; transition: left 90ms ease-out; }
html.us-row #objs > .obj.column.us > .cline.up::before { left: -3px; top: -4px; }
