/* Ethanimate on a phone.

   Everything that changes the layout is under `html.m` (set by js/device.js for
   phone-sized windows), so desktop is exactly what Ethan knows.

   Portrait                     Landscape
   ┌──────────────────────┐     ┌────┬───────┬────────────────┐
   │ 📁 name        ↶ ↷ ⋯ │     │ 📁 name                ↶ ↷ ⋯ │
   ├──────────────────────┤     ├────┤ tool  │                │
   │       canvas         │     │dock│ panel │     canvas     │
   ├──────────────────────┤     │    │       ├────────────────┤
   │ ▶ Play  ＋ ⧉  frames │     │    │       │ ▶ Play ＋ ⧉ …  │
   ├──────────────────────┤     └────┴───────┴────────────────┘
   │  tool panel (scrolls)│
   ├──────────────────────┤
   │ ✏️  🧍  🎁  💥  ●  🎞 │  ← dock: big, thumb-height tabs
   └──────────────────────┘
   Targets are 44px or more, text inputs are 16px (iOS zooms the page below
   that), and nothing relies on hover or right-click. */

/* Touch screens of any size: no double-tap zoom, and the stage never scrolls. */
@media (pointer: coarse) {
  html { touch-action: manipulation; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
  #stage { touch-action: none; }
}

/* Phone-only pieces are invisible everywhere else. */
#moreMenu, #moreShade, #dock, #zoomFit { display: none; }
/* `button.act { display:flex }` out-ranks a plain class, so say it firmly: off the
   phone layout, anything marked .m-only simply isn't there. */
html:not(.m) .m-only { display: none !important; }

html.m {
  --bar-h: 52px;            /* top bar */
  --tl-h: 68px;             /* animation strip */
  --dock-h: 62px;
  --stage-max: 42dvh;       /* tallest the picture may be (portrait) */
  --sheet: #f4f1e6;
  --pop: cubic-bezier(.34, 1.56, .64, 1);   /* a little overshoot: buttons feel springy */
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
html.m.land { --bar-h: 46px; --tl-h: 62px; --stage-max: calc(100dvh - var(--bar-h) - var(--tl-h)); }

/* ------------------------------------------------------------------ frame */

html.m, html.m body { font-size: 15px; }
html.m body {
  position: fixed; left: 0; right: 0; top: 0;
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
html.m footer { display: none; }

html.m.land body {
  grid-template-columns: 64px minmax(200px, 34vw) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
}
html.m.land header   { grid-column: 1 / -1; grid-row: 1; }
html.m.land #dock    { grid-column: 1;      grid-row: 2 / 4; }
html.m.land #toolbar { grid-column: 2;      grid-row: 2 / 4; }
html.m.land #stage   { grid-column: 3;      grid-row: 2; }
html.m.land #timeline{ grid-column: 3;      grid-row: 3; }

html.m header   { grid-row: 1; }
html.m #stage   { grid-row: 2; }
html.m #timeline{ grid-row: 3; }
html.m #toolbar { grid-row: 4; }
html.m #dock    { grid-row: 5; }

/* -------------------------------------------------------------- top bar */

html.m header {
  flex-wrap: nowrap;
  gap: 6px;
  height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: calc(env(safe-area-inset-top) + 4px) 8px 4px;
  align-items: center;
}
html.m header .logo { display: none; }
html.m .project { flex: 1; min-width: 0; gap: 8px; }
html.m #projName { flex: 1; min-width: 0; width: auto; font-size: 16px; height: 42px; padding: 0 12px; border-radius: 12px; }
html.m #galleryBtn .lbl { display: none; }
html.m header .actions { margin-left: 0; flex-wrap: nowrap; gap: 6px; }
html.m header button.act {
  min-width: 44px; height: 44px; padding: 0 10px; font-size: 22px; justify-content: center;
  background: rgba(255,255,255,.2); color: #fff; border: 1px solid rgba(255,255,255,.38);
  border-radius: 13px; box-shadow: none;
}
html.m header button.act:disabled { opacity: .35; }
html.m header button.act:active { background: rgba(255,255,255,.4); transform: scale(.94); }
html.m #moreBtn { display: flex; font-weight: 700; padding-bottom: 6px; }
html.m #galleryBtn { font-size: 22px; }

/* the "is it saved?" chip becomes a small light */
html.m .savechip {
  flex: none; width: 14px; height: 14px; padding: 0; overflow: hidden;
  text-indent: -999px; white-space: nowrap; border-radius: 50%;
  background: rgba(255,255,255,.45);
}
html.m .savechip.saved  { background: #5fd68b; }
html.m .savechip.saving { background: #ffd35a; animation: pulse 1s ease-in-out infinite; }
html.m .savechip.error, html.m .savechip.off { background: #ff6b5e; }
@keyframes pulse { 50% { opacity: .35; } }

/* ⋯ menu */
html.m #moreShade { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(15,25,45,.4); }
html.m #moreMenu {
  display: flex; flex-direction: column; gap: 6px;
  position: fixed; z-index: 60;
  top: calc(env(safe-area-inset-top) + var(--bar-h) + 2px); right: 8px;
  width: min(310px, calc(100vw - 16px));
  max-height: calc(100dvh - var(--bar-h) - 24px);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 8px; background: #fff; border-radius: 18px;
  box-shadow: 0 14px 44px rgba(0,0,0,.45);
  transform-origin: top right; animation: menuIn .18s var(--pop);
}
@keyframes menuIn { from { transform: scale(.85); opacity: 0; } }
html.m #moreMenu button.act { width: 100%; min-height: 52px; justify-content: flex-start; font-size: 16px; padding: 0 14px; gap: 8px; }
html.m #moreMenu #exportGif { order: -2; }
html.m #exportVideo::after { content: 'Make a video'; }
html.m .menu-link {
  display: flex; align-items: center; min-height: 48px; padding: 0 14px; border-radius: 12px;
  color: #2c5f96; font-weight: 600; font-size: 15px; text-decoration: none;
}
html.m .menu-tip { margin: 2px 6px 6px; padding: 10px 12px; font-size: 13px; line-height: 1.4; color: #5d594c; background: #fff7dc; border-radius: 12px; }

/* ------------------------------------------------------------- buttons */

html.m button.act, html.m button.tool, html.m .pose-btn, html.m .stamp, html.m .snd {
  transition: transform .14s var(--pop), background-color .15s;
}
html.m button.act, html.m button.tool {
  min-height: 46px; min-width: 46px; padding: 6px 12px; font-size: 15px;
  border-radius: 13px; justify-content: center;
  box-shadow: 0 2px 0 rgba(0,0,0,.16);
}
html.m button.act:active, html.m button.tool:active, html.m .pose-btn:active, html.m .stamp:active, html.m .snd:active {
  transform: translateY(1px) scale(.95);
}
html.m button.act.mini { min-height: 46px; padding: 6px 12px; font-size: 15px; }
html.m button.tool.active { box-shadow: inset 0 2px 3px rgba(0,0,0,.18), 0 0 0 2px var(--accent); animation: pop .3s var(--pop); }
@keyframes pop { 0% { transform: scale(.9); } 100% { transform: scale(1); } }
html.m button.hero { font-size: 16px; }
html.m .pose-btn { min-height: 44px; padding: 0 14px; font-size: 14px; border-radius: 22px; flex: none; }
html.m .snd { min-height: 44px; padding: 0 14px; font-size: 14px; flex: none; }
html.m .stamp { min-width: 48px; min-height: 48px; font-size: 24px; border-radius: 13px; flex: none; padding: 0 6px; }
html.m label.check { min-height: 44px; font-size: 15px; gap: 8px; }
html.m input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
html.m input[type=number], html.m input[type=text], html.m #hexInput { font-size: 16px; min-height: 44px; padding: 0 10px; border-radius: 10px; }
html.m input[type=number] { width: 64px; }
html.m input[type=color] { width: 56px; height: 44px; border-radius: 10px; }
html.m .label { font-size: 12px; }

/* sliders: a fat track and a thumb a finger can find */
html.m input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; width: auto; min-width: 0; height: 36px; background: transparent; margin: 0; }
html.m input[type=range]::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; background: linear-gradient(#c9c4b4, #b5b0a0); box-shadow: inset 0 1px 2px rgba(0,0,0,.25); }
html.m input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; margin-top: -11px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); box-shadow: 0 2px 5px rgba(0,0,0,.3); }
html.m input[type=range]::-moz-range-track { height: 12px; border-radius: 6px; background: #c2bdad; }
html.m input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); }
html.m input[type=range]:active::-webkit-slider-thumb { transform: scale(1.12); }

/* -------------------------------------------------------------- picture */

html.m #stage {
  flex: none; height: auto; padding: 6px 0;
  background: #2f5a8a;
  position: relative; overflow: hidden;
  touch-action: none;
}
html.m #canvasWrap {
  width: min(100%, calc((var(--stage-max) - 12px) * 1.5625));
  max-width: none; max-height: none; margin: 0 auto;
  transform-origin: 0 0; will-change: transform;
  border: 0; box-shadow: 0 3px 12px rgba(0,0,0,.45);
}
html.m #zoomFit:not(.hidden) {
  display: flex; align-items: center; position: absolute; z-index: 6; left: 10px; top: 10px;
  min-height: 44px; padding: 0 16px; border: 0; border-radius: 22px;
  background: #fff; color: #1c3b63; font: 700 14px/1 inherit; font-family: inherit;
  box-shadow: 0 3px 10px rgba(0,0,0,.35); animation: pop .25s var(--pop);
}
#pinchTip {
  position: absolute; z-index: 6; left: 10px; right: 10px; bottom: 12px; text-align: center;
  padding: 10px 14px; border-radius: 14px; background: rgba(20,32,52,.88); color: #fff;
  font-size: 14px; line-height: 1.3; pointer-events: none; animation: tipIn .3s var(--pop);
}
@keyframes tipIn { from { transform: translateY(14px); opacity: 0; } }

/* ------------------------------------------------------------- timeline */

html.m #timeline {
  flex-direction: row; align-items: center; gap: 8px;
  height: var(--tl-h); padding: 6px 8px; overflow: hidden;
  border-top: 0; background: #e4e0cf;
}
html.m #transport { flex: none; flex-wrap: nowrap; gap: 6px; }
html.m #transport .sep, html.m #rewind { display: none; }
html.m #play { min-width: 92px; height: 52px; font-size: 17px; border-radius: 16px; }
html.m body.playing #play { background: linear-gradient(#ff9a8f, #e5584a); border-color: #a83428; color: #fff; }
html.m #frameAdd, html.m #frameDup {
  flex-direction: column; gap: 0; width: 54px; min-width: 54px; height: 52px; padding: 2px; font-size: 11px; font-weight: 600;
}
html.m #frameAdd .ti, html.m #frameDup .ti { font-size: 22px; line-height: 1.1; }
html.m #strip {
  flex: 1; min-width: 0; height: 100%; align-items: center; padding: 0 2px;
  scrollbar-width: none; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
html.m #strip::-webkit-scrollbar { display: none; }
html.m .frameCell { scroll-snap-align: center; border-radius: 8px; transition: transform .14s var(--pop); }
html.m .frameCell canvas { width: 68px; height: 43px; }
html.m .frameCell:active { transform: scale(.94); }
html.m .frameCell .num { font-size: 11px; padding: 2px 5px; }
html.m .frameCell.current { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,111,208,.4); }

/* --------------------------------------------------------- tool panels */

html.m #toolbar {
  max-height: none; min-height: 0; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 10px 10px 16px; border-top: 0;
  background: var(--sheet);
}
html.m.land #toolbar { padding-bottom: 12px; border-right: 1px solid #c9c4b4; }
html.m .panel.active { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 10px; }
html.m .panel .sep { display: none; }
html.m .panel > *, html.m .lib > * { flex: none; }

/* a row you swipe sideways */
html.m #brushTools, html.m #shapeTools, html.m #stamps, html.m #poses, html.m #kindPicker,
html.m #libTabs, html.m #libCats, html.m #fxButtons, html.m #efxRow, html.m #quickColors {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 8px;
  max-width: none; overflow-x: auto; overflow-y: hidden;
  padding: 3px 2px 8px; margin: 0 -2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
html.m #brushTools::-webkit-scrollbar, html.m #shapeTools::-webkit-scrollbar, html.m #stamps::-webkit-scrollbar,
html.m #poses::-webkit-scrollbar, html.m #kindPicker::-webkit-scrollbar, html.m #libTabs::-webkit-scrollbar,
html.m #libCats::-webkit-scrollbar, html.m #fxButtons::-webkit-scrollbar, html.m #efxRow::-webkit-scrollbar,
html.m #quickColors::-webkit-scrollbar { display: none; }
html.m #brushTools > *, html.m #shapeTools > *, html.m #stamps > *, html.m #poses > *, html.m #kindPicker > *,
html.m #libTabs > *, html.m #libCats > *, html.m #fxButtons > *, html.m #efxRow > * { flex: none; }

/* tool buttons: big icon over its name */
html.m #brushTools button.tool, html.m #shapeTools button.tool {
  flex-direction: column; gap: 2px; width: 74px; min-width: 74px; min-height: 68px; padding: 6px 2px; font-size: 12px; font-weight: 600;
}
html.m button.tool .ico { font-size: 28px; line-height: 1.1; }

html.m .srow { flex-wrap: nowrap; gap: 10px; min-height: 44px; }
html.m .srow .label { flex: none; width: auto; min-width: 92px; white-space: nowrap; }
html.m.land .srow { flex-wrap: wrap; gap: 4px 10px; }
html.m.land .srow .label { flex: 1 1 auto; width: auto; }
html.m.land .srow input[type=range] { order: 5; flex: 1 1 100%; }
html.m #sizePreviewWrap { width: 48px; height: 48px; flex: none; }
html.m #sizeNum, html.m #opacityNum { width: auto !important; min-width: 40px; font-weight: 700; text-align: right; }

/* the colour you are painting with, one swipe away */
html.m #quickColors { padding-top: 2px; }
html.m #quickColors .swatch {
  flex: none; width: 42px; height: 42px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.28), 0 2px 3px rgba(0,0,0,.2);
  transition: transform .14s var(--pop);
}
html.m .swatch:active { transform: scale(.88); }

/* Figures */
html.m .panel[data-panel="figures"].active { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
html.m .panel[data-panel="figures"] > .row, html.m .panel[data-panel="figures"] > #kindPicker,
html.m .panel[data-panel="figures"] > .label, html.m .panel[data-panel="figures"] > #poses { grid-column: 1 / -1; }
html.m .panel[data-panel="figures"] > .row > * { flex: none; }
html.m .panel[data-panel="figures"] > .row:not(#kindPicker) { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 3px 2px 8px; }
html.m .panel[data-panel="figures"] > .row:not(#kindPicker)::-webkit-scrollbar { display: none; }
html.m #kindPicker .stamp { font-size: 26px; }
html.m #addPuppet, html.m #poseToolBtn { min-height: 54px; font-size: 16px; font-weight: 700; flex-direction: row; }

/* Library */
html.m .lib { flex: none; min-width: 0; gap: 10px; }
html.m #libTabs .pose-btn { min-height: 46px; }
html.m #libTabs button.tool { min-height: 46px; flex-direction: row; width: auto; min-width: 0; padding: 0 14px; font-size: 14px; }
html.m .lib-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px;
  max-height: none; overflow: visible; padding: 2px;
}
html.m .lib-item, html.m .lib-item.wide { width: auto; height: 64px; border-radius: 12px; }
html.m .lib-item .x { width: 28px; height: 28px; top: -8px; right: -8px; line-height: 24px; font-size: 14px; }
html.m .lib-item .tag { font-size: 10px; }
html.m .lib-side { max-width: none; gap: 8px; }
html.m .lib-side .row { flex-wrap: wrap; gap: 8px; }
html.m .lib-note { font-size: 13px; max-width: none; }

/* Effects */
html.m #fxButtons .stamp, html.m #efxRow .stamp { font-size: 15px; min-height: 48px; padding: 0 14px; white-space: nowrap; }
html.m #clearFx { align-self: flex-start; }

/* Colors */
html.m .panel[data-panel="colors"].active {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px;
}
html.m #currentColors { grid-column: 1; grid-row: 1; width: 76px; height: 76px; }
html.m #palette { grid-column: 2; grid-row: 1; }
html.m #wheelWrap { grid-row: 2; }
html.m #customBox { grid-row: 3; }
html.m #currentColors .chip { width: 50px; height: 50px; border-radius: 12px; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 2px 4px rgba(0,0,0,.3); }
html.m #swapColors { width: 34px; height: 34px; font-size: 16px; top: -6px; right: -6px; border-radius: 50%; }
html.m #palette { grid-template-columns: repeat(auto-fill, 38px); grid-auto-rows: 38px; gap: 6px; justify-content: start; }
html.m .swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.28); }
html.m #palette .swatch:hover { outline: 0; }
html.m #wheelWrap { grid-column: 1 / -1; flex-direction: column; align-items: center; gap: 10px; }
html.m #wheel { width: min(220px, 62vw); height: min(220px, 62vw); touch-action: none; }
html.m .vslider { transform: none; width: min(260px, 80%) !important; margin: 0; }
html.m #customBox { grid-column: 1 / -1; flex-direction: row !important; align-items: center; gap: 10px !important; }
html.m #hexInput { flex: 1; min-width: 0; width: auto; }

/* Movie (the animation options that moved here from the timeline) */
html.m .panel[data-panel="movie"].active { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
html.m #moviePanel .fps { order: 1; flex: 1 1 100%; display: flex; align-items: center; gap: 10px; }
html.m #moviePanel .fps .label { width: 56px; }
html.m #moviePanel #fpsNum { width: 60px !important; font-weight: 700; }
html.m #moviePanel label.check { order: 2; padding: 0 14px 0 10px; background: #fff; border: 2px solid #c9c4b4; border-radius: 22px; }
html.m #moviePanel label.check:has(input:checked) { border-color: var(--accent); background: #e8f0fd; }
html.m #moviePanel #tween { order: 3; }
html.m #moviePanel #tweenCount { order: 3; }
html.m #moviePanel #frameLeft, html.m #moviePanel #frameRight, html.m #moviePanel #frameDel { order: 4; }
html.m #moviePanel #frameLabel { order: 5; margin-left: auto; font-size: 15px; }

/* --------------------------------------------------------------- the dock */

html.m #dock {
  display: block; z-index: 5; position: relative;
  background: linear-gradient(#3b72ad, #2c5f96);
  padding: 5px 6px calc(env(safe-area-inset-bottom) + 5px);
  box-shadow: 0 -3px 10px rgba(0,0,0,.28);
}
html.m #tabs { margin: 0; flex-wrap: nowrap; gap: 4px; justify-content: space-between; }
html.m .tab {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  height: calc(var(--dock-h) - 10px); padding: 3px 2px; border-radius: 15px;
  background: transparent; border-color: transparent; color: #fff;
  transition: transform .2s var(--pop), background-color .15s;
}
html.m .tab.m-only { display: flex; }
html.m .tab .ti { font-size: 24px; line-height: 1.1; }
html.m .tab .tl { font-size: 11px; font-weight: 600; line-height: 1.1; }
html.m .tab:active { transform: scale(.92); }
html.m .tab.active { background: #fff; color: #1c3b63; border-color: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.22); transform: translateY(-2px); }
/* the Colors tab shows the colour you are painting with */
html.m .tab[data-tab="colors"] .ti {
  width: 26px; height: 26px; border-radius: 50%; font-size: 0; margin: 0 0 1px;
  background: var(--cur, #000); border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.4);
}

html.m.land #dock { padding: 6px 4px; overflow-y: auto; scrollbar-width: none; box-shadow: 2px 0 10px rgba(0,0,0,.25); }
html.m.land #tabs { flex-direction: column; justify-content: flex-start; gap: 4px; }
html.m.land .tab { flex: none; height: 48px; }
html.m.land .tab .ti { font-size: 20px; }
html.m.land .tab[data-tab="colors"] .ti { width: 22px; height: 22px; font-size: 0; }
html.m.land .tab .tl { font-size: 10px; }

/* ----------------------------------------------------------------- sheets */

html.m .modal { padding: 0; align-items: flex-end; }
html.m .modal-card, html.m .ask, html.m .gallery, html.m .editor {
  width: 100%; max-width: none; max-height: 92dvh;
  border-radius: 22px 22px 0 0; border: 0;
  padding: 16px 14px calc(env(safe-area-inset-bottom) + 14px);
  animation: sheetUp .26s var(--pop);
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
html.m.land .modal-card { max-height: 98dvh; }
html.m .ask p { font-size: 16px; }
html.m .ask-buttons button { min-height: 54px; font-size: 16px; padding: 0 16px; }
html.m .gal-head { gap: 8px; }
html.m .gal-head h2 { width: 100%; margin: 0; }
html.m .gal-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
html.m .gal-actions button { min-height: 44px; min-width: 44px; font-size: 14px; }
html.m .ed-stage { height: min(40dvh, 340px); }
html.m .ed-right { flex: 1 1 100%; }
html.m .ed-fx .stamp { min-height: 44px; font-size: 14px; }
/* The sheet scrolls; nothing inside it may shrink and spill over its neighbours. */
html.m .editor > * { flex: none; }
html.m .editor .modal-actions {
  position: sticky; bottom: 0; z-index: 2;
  margin: 8px -14px calc(-1 * (env(safe-area-inset-bottom) + 14px)); padding: 8px 14px calc(env(safe-area-inset-bottom) + 10px);
  background: var(--bar); border-top: 1px solid #c9c4b3;
}
html.m .editor .modal-actions .act { flex: 1 1 auto; min-height: 44px; }
html.m .ed-modes { flex-wrap: wrap; }
html.m .ed-modes .tool, html.m .ed-modes .act, html.m .ed-acts .act { min-height: 44px; font-size: 14px; }
html.m .ed-acts { width: 100%; }
html.m #edPieceSize { flex: 1 1 140px; width: auto; min-width: 120px; }
html.m .ed-hint { flex: 1 1 100%; margin-left: 0; font-size: 14px; }
html.m #libPhoto { flex: none; min-height: 44px; }

html.m #toast {
  top: calc(env(safe-area-inset-top) + var(--bar-h) + 8px);
  left: 12px; right: 12px; transform: none; max-width: none; width: auto;
  text-align: center; font-size: 15px; line-height: 1.35;
}

@media (prefers-reduced-motion: reduce) {
  html.m * { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------ Photos / Files / Share sheet
   (js/deliver.js) Not phone-scoped: an iPad in the desktop layout gets it too. */
.deliver { width: min(440px, 100%); }
.deliver h2 { margin: 0 0 10px; text-align: center; }
.del-preview {
  display: flex; justify-content: center; margin-bottom: 10px;
  background: repeating-conic-gradient(#e6e6e6 0 25%, #fff 0 50%) 0 0 / 16px 16px;
  border: 1px solid #a9a495; border-radius: 12px; overflow: hidden;
}
.del-preview img, .del-preview video { display: block; max-width: 100%; max-height: 34dvh; }
.del-status { min-height: 22px; margin: 4px 0 8px; text-align: center; font-size: 15px; font-weight: 600; color: #5d594c; }
.del-status.good { color: #1f7a3a; }
.del-hint { margin: 10px 4px 0; font-size: 13px; line-height: 1.4; color: #5d594c; text-align: center; }
.del-hint:empty { display: none; }
.deliver .ask-buttons button { justify-content: center; min-height: 54px; font-size: 17px; border-radius: 14px; }
.deliver .ask-buttons button.quiet { background: transparent; border-color: transparent; box-shadow: none; font-size: 15px; min-height: 44px; }

/* ------------------------------------------------------ "Add a picture" sheet */
.addpic-lead { margin: 0 0 6px; text-align: center; }
