/* ==========================================================================
   mobile-links.css (unit F5): the Links tab, the item sheet, the file
   viewer, the Search screen, and the reused item creator / media library /
   quick-link modal on the phone shell. Loaded last; every rule keys on
   html[data-shell="mobile"] (structural) or
   html[data-fx="v2"][data-shell="mobile"] body[data-style="glass"][data-theme]
   (glass, 0,5,2+), so tablet and desktop never see any of it.
   House rules (mobile.css): tokens only, no new hues; no transitions on
   .card panes; motion only on small elements. NEVER recolour, filter or
   overlay .icon-button img (only the user's .invert-dark opt-in applies) and
   never add pseudo content, opacity or filters to copy-paste pills or colour
   swatches (their core stays var(--copy-base)).
   Sections: 1 Links screen and card panes · 2 icon grid, labels, thumbs ·
   3 item sheet, file viewer · 4 search screen · 5 reused: item creator, media
   library, quick-link modal · 6 dark · 7 sunset · 8 keyframes · 9 a11y ·
   10 landscape
   ========================================================================== */

/* --- 1. Links screen and card panes --------------------------------------- */
html[data-shell="mobile"] .mx-links {
  display: grid;
  gap: 12px;
  padding-top: 10px;
  min-width: 0;
}
html[data-shell="mobile"] .mx-section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: var(--mx-hit);
  padding: 0 4px;
}
html[data-shell="mobile"] .mx-caption {
  margin: 0;
  font: 700 11px/1.3 'Inter', system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
html[data-shell="mobile"] .mx-caption-count { font-variant-numeric: tabular-nums; }
html[data-shell="mobile"] .mx-caption-count:empty { display: none; }
html[data-shell="mobile"] .mx-caption-count::before { content: "· "; }
html[data-shell="mobile"] .mx-qa-add {
  position: relative;
  min-height: 36px; padding: 0 12px; gap: 4px;
  margin-right: -6px;
  font-size: 14px; color: var(--text);
}
html[data-shell="mobile"] .mx-qa-add::before { content: ""; position: absolute; inset: -4px 0; }   /* 36px look, 44px hit */
html[data-shell="mobile"] .mx-qa-add svg { width: 16px; height: 16px; }
html[data-shell="mobile"] .mx-qa-body {
  container-type: inline-size;
  display: grid; gap: 10px;
  min-width: 0;
}
html[data-shell="mobile"] .mx-qa-empty,
html[data-shell="mobile"] .mx-card-empty {
  margin: 0; padding: 4px 6px 2px;
  font-size: 13px; line-height: 1.45; color: var(--muted);
}
html[data-shell="mobile"] .mx-cards { display: grid; gap: 10px; min-width: 0; }
html[data-shell="mobile"] .mx-links-foot {
  margin: 6px 0 0; padding: 0 8px;
  text-align: center;
  font-size: 12.5px; line-height: 1.4; color: var(--muted);
}

/* The pane is a real .card (the glass shell, bevels and corner light come
   with it); only its geometry changes. No transition: glass-glow measures it. */
html[data-shell="mobile"] section.card.mx-card {
  margin: 0;
  padding: 0 12px;
  min-height: 0;
  border-radius: var(--mx-radius);
  transition: none;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
html[data-shell="mobile"] section.card.mx-card.is-open { padding-bottom: 14px; }
html[data-fx="v2"][data-shell="mobile"] body[data-style="glass"][data-theme] section.card.mx-card { border-radius: var(--mx-radius); }

html[data-shell="mobile"] .mx-card-head {
  position: relative;
  display: flex; align-items: center; gap: 4px;
  height: 52px;
  min-width: 0;
}
html[data-shell="mobile"] .mx-card-toggle {
  flex: 1 1 auto;
  display: flex; align-items: center; gap: 10px;
  min-width: 0; height: 100%;
  margin: 0; padding: 0 0 0 4px;
  border: 0; background: transparent; color: var(--text);
  font: inherit; text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
/* The whole header toggles; Notes and ＋ sit above this hit layer */
html[data-shell="mobile"] .mx-card-toggle::after { content: ""; position: absolute; inset: 0; border-radius: var(--mx-radius) var(--mx-radius) 0 0; }
html[data-fx="v2"][data-shell="mobile"] body[data-style="glass"][data-theme] .mx-card-toggle:focus-visible { outline: none; }
html[data-shell="mobile"] .mx-card-toggle:focus-visible::after { outline: 2px solid rgb(var(--fx-ind-rgb, 22 160 255) / 70%); outline-offset: -3px; }
html[data-shell="mobile"] .mx-card-title {
  flex: 0 0 auto; min-width: 0; max-width: 100%;
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Whole pieces only: links-view.js folds thumbs that don't fit into "+N" and
   drops counts that don't fit (no fade over half a thumb or half a word) */
html[data-shell="mobile"] .mx-card-sum {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px; font-weight: 500;
}
html[data-shell="mobile"] .mx-card-sum > [hidden] { display: none !important; }
html[data-shell="mobile"] .mx-card-sum > * { flex: 0 0 auto; }
html[data-shell="mobile"] .mx-card-count { white-space: nowrap; font-variant-numeric: tabular-nums; }
html[data-shell="mobile"] .mx-card-more { flex: 0 0 auto; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; padding-left: 2px; }
html[data-shell="mobile"] :is(.mx-notes-chip, .mx-card-add) { position: relative; z-index: 1; flex: 0 0 auto; }
html[data-shell="mobile"] .mx-chip.mx-notes-chip {
  min-height: 30px; padding: 0 9px; gap: 4px;
  font-size: 12px;
}
html[data-shell="mobile"] .mx-chip.mx-notes-chip::before { inset: -7px 0; }   /* 44px hit */
html[data-shell="mobile"] .mx-notes-chip svg { width: 13px; height: 13px; color: var(--muted); }
html[data-shell="mobile"] .mx-card-add svg { width: 20px; height: 20px; }
html[data-shell="mobile"] .mx-card-chev {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; margin-right: 2px;
  color: var(--muted);
  pointer-events: none;
}
html[data-shell="mobile"] .mx-card.is-open .mx-card-chev svg { transform: rotate(180deg); }

html[data-shell="mobile"] .mx-card-body {
  container-type: inline-size;
  display: grid; gap: 14px;
  min-width: 0;
  padding-top: 2px;
}
html[data-shell="mobile"] .mx-card-group { display: grid; gap: 10px; min-width: 0; }
html[data-shell="mobile"] .mx-sub-caption {
  margin: 2px 4px -2px;
  font: 700 11px/1.3 'Inter', system-ui, sans-serif;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}
/* Pills: one column whatever the container (the shell's own rule beats the
   card container queries' !important only by restating it) */
html[data-shell="mobile"] .mx-items :is(.unified-reminders-group, .unified-subtasks-group, .unified-copypaste-group) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 8px !important;
  margin: 0;
  min-width: 0;
}
html[data-shell="mobile"] .mx-items .unified-swatch-group { margin: 0; }

/* Items on touch: no callout, no selection, no double-tap zoom wait */
html[data-shell="mobile"] .mx-items :is(.icon-button, .unified-reminder-item, .unified-subtask-item, .unified-copypaste-item) {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
/* Small toggles get a 44px-tall hit area through an invisible layer */
html[data-shell="mobile"] .mx-items :is(.reminder-links-toggle, .list-item-links-toggle, .reminder-tasks-toggle,
  .list-item-tasks-toggle, .list-item-notes-toggle) {
  position: relative;
  touch-action: manipulation;
}
html[data-shell="mobile"] .mx-items :is(.reminder-links-toggle, .list-item-links-toggle, .reminder-tasks-toggle,
  .list-item-tasks-toggle, .list-item-notes-toggle)::after {
  content: ""; position: absolute; inset: -11px -8px;
}
html[data-shell="mobile"] .mx-items .list-item-notes-toggle { opacity: 0.55; }
html[data-shell="mobile"] .mx-items .list-item-notes-toggle.has-note { opacity: 1; }

/* Quick links (＋ Link) */
html[data-shell="mobile"] .mx-quick-link { cursor: pointer; }
html[data-shell="mobile"] .mx-quick-link .unified-subtask-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
html[data-shell="mobile"] .mx-quick-link-icon { display: inline-flex; flex: 0 0 auto; color: var(--muted); }
html[data-shell="mobile"] .mx-quick-link-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- 2. Icon grid, labels, thumbs -------------------------------------------
   The real 84px tile at zoom .76 (64px): the whole container zooms, the image
   is never resized on its own. Labels sit outside the tile. */
html[data-shell="mobile"] .unified-icons-group.mx-icon-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 6px;
  justify-items: center;
  align-items: start;
  margin: 0;
  padding: 4px 0 0;
  min-width: 0;
}
html[data-shell="mobile"] .mx-icon-cell {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%; min-width: 0;
}
html[data-shell="mobile"] .mx-icon-zoom { zoom: 0.76; line-height: 0; }
html[data-shell="mobile"] .mx-icon-zoom .icon-button { margin: 0; }
/* An R2 picture that can't load (signed out): an empty tile, not the alt text */
html[data-shell="mobile"] .mx-icon-zoom .icon-button img:not([src]) { visibility: hidden; }
html[data-shell="mobile"] .mx-icon-label {
  max-width: 100%;
  padding: 0 2px;
  font: 500 11px/1.25 'Inter', system-ui, sans-serif;
  color: var(--muted);
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
html[data-shell="mobile"] .mx-icon-sep {
  grid-column: 1 / -1;
  justify-self: stretch;
  height: 1px; margin: 0 10px;
  background: var(--glass-divider);
}
/* The indicator light: restated tokens (like edit mode's zoomed tiles) and a
   44px hit through padding + negative margin; the pool and core keep their
   size (their insets give back the padding) */
html[data-shell="mobile"] .mx-icon-zoom .icon-button > .icon-indicator { touch-action: manipulation; }
html[data-fx="v2"][data-shell="mobile"] body[data-style="glass"][data-theme] .mx-icon-zoom .icon-button > .icon-indicator {
  --mx-ind-pad: 19px;
  --fx-pool-inset: calc(-30px + var(--mx-ind-pad));
  --fx-pool-rx: 42px;
  --fx-pool-ry: 30px;
  --fx-core-inset: calc(-3px + var(--mx-ind-pad));
  width: calc(20px + 2 * var(--mx-ind-pad));
  height: calc(20px + 2 * var(--mx-ind-pad));
  margin: calc(-1 * var(--mx-ind-pad));
  padding: 0;
}
/* No sticky hover lift on touch */
@media (hover: none) {
  html[data-shell="mobile"] .mx-items .icon-button:hover { transform: none; }
}

/* Mini thumbs in a collapsed header: same pixels, framed like a tiny tile */
html[data-shell="mobile"] .mx-thumb {
  --mx-thumb: 20px;
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--mx-thumb); height: var(--mx-thumb);
  border-radius: 6px;
  overflow: hidden;
  background: var(--glass-reflection), var(--glass-field);
  box-shadow: var(--glass-rim, 0 0 0 1px var(--glass-divider));
}
html[data-shell="mobile"] .mx-thumb img { display: block; width: 78%; height: 78%; object-fit: contain; }
/* An R2 picture that can't load (signed out) leaves no empty frame */
html[data-shell="mobile"] .mx-thumb:has(> img:not([src])) { display: none; }
html[data-shell="mobile"] .mx-thumb--emoji { font-size: calc(var(--mx-thumb) * 0.72); line-height: 1; }

/* --- 3. Item sheet and file viewer ----------------------------------------------- */
html[data-shell="mobile"] .mx-item-head {
  display: flex; align-items: center; gap: 12px;
  padding: 2px 0 12px;
}
html[data-shell="mobile"] .mx-item-head .mx-thumb { border-radius: 12px; }
html[data-shell="mobile"] .mx-item-names { flex: 1 1 auto; min-width: 0; }
html[data-shell="mobile"] .mx-item-title {
  margin: 0;
  font-size: 18px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
html[data-shell="mobile"] .mx-item-where { margin: 2px 0 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-shell="mobile"] .mx-item-open { flex: 0 0 auto; gap: 2px; padding: 0 10px 0 14px; }
html[data-shell="mobile"] .mx-item-open svg { width: 16px; height: 16px; }
html[data-shell="mobile"] .mx-item-sheet .mx-caption { margin: 10px 4px 8px; }
html[data-shell="mobile"] .mx-link-list { display: grid; gap: 8px; }
html[data-shell="mobile"] .mx-link-divider {
  margin: 6px 4px 0;
  font: 700 11px/1.3 'Inter', system-ui, sans-serif;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
/* Link pills keep the bubble look and the link's colour, at 44px */
html[data-shell="mobile"] .reminder-link-bubble.mx-link-pill {
  display: flex; align-items: center; gap: 10px;
  box-sizing: border-box;
  width: 100%; max-width: none; min-height: var(--mx-hit);
  padding: 0 16px;
  border: 1px solid var(--glass-divider);
  border-radius: 999px;
  color: var(--text);
  font: 500 15px/1.2 'Inter', system-ui, sans-serif;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  opacity: 1; transform: none; animation: none;
  box-shadow: var(--fx-lift-pill, 0 2px 8px rgb(0 0 0 / 12%)), var(--glass-rim, none);
  cursor: pointer;
  touch-action: manipulation;
}
html[data-shell="mobile"] .mx-link-pill svg { flex: 0 0 auto; width: 16px; height: 16px; color: var(--muted); }
html[data-shell="mobile"] .mx-link-pill-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
html[data-shell="mobile"] .mx-link-pill:active { filter: none; background-color: var(--glass-hover); }
html[data-shell="mobile"] .mx-item-tasks { display: grid; gap: 8px; }
html[data-shell="mobile"] .mx-item-foot { margin: 16px 4px 4px; }

/* Plain rows (search results, tasks when the Tasks unit is not loaded) */
html[data-shell="mobile"] .mx-row {
  display: flex; align-items: center; gap: 10px;
  box-sizing: border-box;
  width: 100%; min-height: 52px;
  margin: 0; padding: 8px 14px;
  border: 1px solid var(--glass-divider);
  border-radius: 16px;
  background: var(--glass-reflection), var(--glass-field);
  color: var(--text);
  font: 500 15px/1.3 'Inter', system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
html[data-fx="v2"][data-shell="mobile"] body[data-style="glass"][data-theme] .mx-row { box-shadow: var(--fx-lift-pill), var(--glass-rim); }
html[data-shell="mobile"] .mx-row:active { background-color: var(--glass-hover); }
html[data-shell="mobile"] .mx-row-dot {
  flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%;
  background: rgb(var(--priority-rgb));
  box-shadow: 0 0 8px rgb(var(--priority-rgb) / 60%);
}
html[data-shell="mobile"] .mx-row-title { min-width: 0; flex: 1 1 auto; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-shell="mobile"] .mx-row-meta { flex: 0 0 auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
html[data-shell="mobile"] .mx-row-glyph { display: inline-flex; flex: 0 0 auto; color: var(--muted); }

/* File viewer (file-sheet.js): images full screen, and the file card of a
   blocked popup. A child of <body> at z 10050: the one deliberate exception
   to the shell's < 1000 plan (mobile.css §1), so it opens over the writer
   frames (≤ 10011), the calendar (10000), meetings (10001) and focus mode
   (10040) it is opened from, and stays under the help window (10060), the
   writing menus (100004), quick capture (100100) and #toast (100150), so its
   own toasts still show. Black in every theme (the photo convention); no
   full-screen blur (the glass stack's GPU cost). The whole viewer takes every
   touch (touch-action: none, the bar and its buttons too: a pinch never zooms
   the page under it, and taps still click); the picture moves only through
   paused Web Animations (createMover), so nothing here transitions but the
   bar's opacity. */
html[data-shell="mobile"] .mx-viewer {
  position: fixed;
  z-index: 10050;
  touch-action: none;
  left: var(--mx-inline); right: var(--mx-inline);
  top: var(--mx-vv-top, 0px);
  height: var(--mx-vvh, 100dvh);
  overflow: hidden;
  overscroll-behavior: none;
  color: #fff;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  outline: none;
}
html[data-shell="mobile"] .mx-viewer-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / 94%); }
html[data-shell="mobile"] .mx-viewer-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
}
html[data-shell="mobile"] .mx-viewer[data-mode="image"] .mx-viewer-stage { cursor: zoom-in; }
/* The element fills the stage; the picture is fitted inside it (contain), so
   the transform origin (its centre) is the stage centre */
html[data-shell="mobile"] .mx-viewer-img {
  position: absolute; inset: 0;
  display: block;
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;                     /* the stage takes the pointers */
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
}
html[data-shell="mobile"] .mx-viewer-bar {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; align-items: center; gap: 4px;
  padding: calc(var(--mx-safe-t) + 6px) max(8px, var(--mx-safe-r)) 22px max(8px, var(--mx-safe-l));
  background-image: linear-gradient(rgb(0 0 0 / 62%), rgb(0 0 0 / 28%) 60%, rgb(0 0 0 / 0%));
  transition: opacity 0.16s ease;
}
/* A single tap on the picture hides the bar; keyboard focus brings it back */
html[data-shell="mobile"] .mx-viewer[data-chrome="off"] .mx-viewer-bar:not(:focus-within) { opacity: 0; pointer-events: none; }
html[data-shell="mobile"] .mx-viewer-title {
  flex: 1 1 auto; min-width: 0;
  margin: 0 6px;
  font: 600 16px/1.25 'Inter', system-ui, sans-serif;
  letter-spacing: -0.01em;
  color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgb(0 0 0 / 55%);
}
html[data-shell="mobile"] .mx-viewer-actions { flex: 0 0 auto; display: flex; gap: 6px; }
/* Round 44px buttons; colour in background-image (no glass-glow bloom) */
html[data-shell="mobile"] .mx-viewer-btn {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  box-sizing: border-box;
  width: var(--mx-hit); height: var(--mx-hit);
  margin: 0; padding: 0;
  border: 0; border-radius: 50%;
  background-color: transparent;
  background-image: linear-gradient(rgb(28 30 34 / 58%), rgb(28 30 34 / 58%));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 14%);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  touch-action: none;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
html[data-shell="mobile"] .mx-viewer-btn:active { background-image: linear-gradient(rgb(255 255 255 / 24%), rgb(255 255 255 / 24%)); }
html[data-shell="mobile"] .mx-viewer :is(.mx-viewer-btn, .mx-viewer-pill):focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
/* Messages, Try again and the file card's Open */
html[data-shell="mobile"] :is(.mx-viewer-msg, .mx-viewer-file) {
  position: relative;
  display: grid; justify-items: center; gap: 14px;
  max-width: 320px;
  padding: 0 28px;
  text-align: center;
  color: rgb(255 255 255 / 80%);
  -webkit-user-select: text;
  user-select: text;
}
html[data-shell="mobile"] :is(.mx-viewer-msg, .mx-viewer-file) p { margin: 0; font-size: 15px; line-height: 1.45; }
html[data-shell="mobile"] .mx-viewer-file .mx-viewer-file-name { color: #fff; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
html[data-shell="mobile"] .mx-viewer-file .mx-viewer-note { font-size: 13.5px; color: rgb(255 255 255 / 72%); }
html[data-shell="mobile"] .mx-viewer-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-sizing: border-box;
  min-height: var(--mx-hit); padding: 0 22px;
  margin: 4px 0 0;
  border: 1px solid rgb(255 255 255 / 32%); border-radius: 999px;
  background-color: transparent;
  background-image: linear-gradient(rgb(255 255 255 / 10%), rgb(255 255 255 / 10%));
  color: #fff;
  font: 600 15px/1.2 'Inter', system-ui, sans-serif;
  cursor: pointer;
  touch-action: none;
}
html[data-shell="mobile"] .mx-viewer-pill.is-primary { border-color: transparent; background-image: linear-gradient(var(--glass-action, #42699b), var(--glass-action, #42699b)); }
html[data-shell="mobile"] .mx-viewer-pill:active { background-image: linear-gradient(rgb(255 255 255 / 24%), rgb(255 255 255 / 24%)); }
html[data-shell="mobile"] .mx-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--glass-divider);
  border-top-color: rgb(var(--fx-ind-rgb, 22 160 255));
  animation: mxLinksSpin 0.9s linear infinite;
}
html[data-shell="mobile"] .mx-viewer .mx-spinner { border-color: rgb(255 255 255 / 22%); border-top-color: #fff; }

/* --- 4. Search screen ------------------------------------------------------------ */
html[data-shell="mobile"] .mx-search .mx-pushed-bar { gap: 8px; padding-left: var(--mx-gutter); }
html[data-shell="mobile"] .mx-search :is(.mx-pushed-back, .mx-pushed-title) { display: none; }
html[data-shell="mobile"] .mx-search-field {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 6px;
  height: 40px;
  margin: 0; padding: 0 4px 0 12px;
  border: 1px solid var(--glass-divider);
  border-radius: 999px;
  background: var(--glass-reflection), var(--glass-field);
  color: var(--muted);
}
html[data-fx="v2"][data-shell="mobile"] body[data-style="glass"][data-theme] .mx-search-field { box-shadow: inset 0 1px 2px rgb(0 0 0 / 6%), var(--glass-rim); }
html[data-fx="v2"][data-shell="mobile"] body[data-style="glass"][data-theme] .mx-search-field:focus-within { border-color: rgb(var(--fx-ind-rgb, 22 160 255) / 60%); box-shadow: 0 0 0 3px rgb(var(--fx-ind-rgb, 22 160 255) / 16%); }
html[data-shell="mobile"] .mx-search-field > svg { flex: 0 0 auto; }
html[data-shell="mobile"] .mx-search-input {
  flex: 1 1 auto; min-width: 0;
  height: 100%;
  margin: 0; padding: 0;
  border: 0; outline: none;
  background: transparent;
  color: var(--text);
  font: 400 16px/1.2 'Inter', system-ui, sans-serif;     /* 16px: no iOS zoom on focus */
  -webkit-appearance: none;
  appearance: none;
}
html[data-fx="v2"][data-shell="mobile"] body[data-style="glass"][data-theme] .mx-search-input:is(:focus, :focus-visible) { outline: none; box-shadow: none; }   /* the field shows focus */
html[data-shell="mobile"] .mx-search-input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
html[data-shell="mobile"] .mx-search-input::placeholder { color: var(--muted); opacity: 0.85; }
html[data-shell="mobile"] .mx-search-clear {
  position: relative;
  flex: 0 0 auto;
  display: none; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  margin: 0; padding: 0;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--muted);
  cursor: pointer;
}
html[data-shell="mobile"] .mx-search-field.has-text .mx-search-clear { display: inline-flex; }
html[data-shell="mobile"] .mx-search-clear::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; }   /* 32px look, 44px hit */
html[data-shell="mobile"] .mx-search-cancel {
  flex: 0 0 auto;
  min-height: var(--mx-hit); padding: 0 4px;
  border: 0; background: transparent;
  color: var(--text);
  font: 600 15px/1 'Inter', system-ui, sans-serif;
  cursor: pointer;
}
html[data-shell="mobile"] .mx-search-results {
  container-type: inline-size;
  display: grid; gap: 18px;
  padding-top: 8px;
  min-width: 0;
}
html[data-shell="mobile"] .mx-search-message,
html[data-shell="mobile"] .mx-search-zero {
  margin: 4px 4px 0;
  font-size: 13.5px; line-height: 1.45; color: var(--muted);
}
html[data-shell="mobile"] .mx-search-zero { font: 700 11px/1.6 'Inter', system-ui, sans-serif; letter-spacing: 0.08em; text-transform: uppercase; white-space: pre-wrap; }
html[data-shell="mobile"] .mx-search-group { display: grid; gap: 8px; min-width: 0; }
html[data-shell="mobile"] .mx-search-group > .mx-caption { padding: 0 4px; }
html[data-shell="mobile"] .mx-search-list { display: grid; gap: 8px; min-width: 0; }
html[data-shell="mobile"] .mx-search-more[hidden] { display: none; }
html[data-shell="mobile"] .mx-search-more { justify-self: start; min-height: 40px; padding: 0 8px; color: rgb(var(--fx-ind-rgb, 22 160 255)); }
html[data-shell="mobile"] .mx-search-item { display: grid; gap: 4px; min-width: 0; }
html[data-shell="mobile"] .mx-search-where {
  margin: 0 4px;
  font-size: 12px; line-height: 1.3; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
html[data-shell="mobile"] .mx-search-icon-row {
  display: flex; align-items: center; gap: 12px;
  min-width: 0;
  padding: 2px 4px;
}
html[data-shell="mobile"] .mx-search-icon-row .mx-icon-cell { width: auto; flex: 0 0 auto; }
html[data-shell="mobile"] .mx-search-icon-row .mx-icon-zoom { zoom: 0.6; }   /* 50px tiles in a result row */
html[data-shell="mobile"] .mx-search-icon-names { display: grid; gap: 2px; min-width: 0; }
html[data-shell="mobile"] .mx-search-icon-names .mx-search-where { margin: 0; }
html[data-shell="mobile"] .mx-doc-row {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px;
  align-items: start;
  padding: 10px 14px;
}
html[data-shell="mobile"] .mx-row-kicker {
  font: 700 10.5px/1.3 'Inter', system-ui, sans-serif;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
html[data-shell="mobile"] .mx-row-snippet {
  font-size: 13px; line-height: 1.4; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
html[data-shell="mobile"] .mx-done-row { cursor: default; padding-right: 4px; }
html[data-shell="mobile"] .mx-done-ring {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  color: #fff;
  background-image: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 55%), transparent 60%),
    linear-gradient(145deg, rgb(var(--fx-live-rgb, 24 211 116)), rgb(var(--fx-live-deep, 6 122 66)));
  box-shadow: 0 0 8px -2px rgb(var(--fx-live-rgb, 24 211 116) / 70%);
}
html[data-shell="mobile"] .mx-done-names { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; }
html[data-shell="mobile"] .mx-done-names .mx-row-title { color: var(--muted); }
html[data-shell="mobile"] .mx-restore-btn svg { width: 18px; height: 18px; }

/* --- 5. Reused: item creator, media library, quick-link modal ----------------------
   The item creator (z 3000) becomes a bottom sheet pinned to the column (as
   tall as its form, up to the full height, scrolling inside);
   no Separator tab on a phone (placement mode needs a grid card). Inputs are
   16px (no iOS zoom on focus). The ≤520px rules of styles.css are restated
   under the prefix, so the preview equals a phone. */
html[data-shell="mobile"] .ic-overlay {
  left: var(--mx-inline); right: var(--mx-inline);
  top: var(--mx-vv-top, 0px); bottom: auto;
  height: var(--mx-vvh, 100dvh);
  padding: calc(var(--mx-safe-t) + 8px) 0 0;
  align-items: stretch;
  overflow: hidden;
}
html[data-shell="mobile"] .ic-overlay .ic-dialog {
  width: 100%; max-width: none;
  max-height: 100%;
  margin-top: auto;
  border-radius: var(--mx-radius-sheet) var(--mx-radius-sheet) 0 0;
  border-bottom: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: var(--mx-safe-b);
}
html[data-fx="v2"][data-shell="mobile"] body[data-style="glass"][data-theme] .ic-overlay .ic-dialog {
  background:
    linear-gradient(90deg, transparent 6%, rgb(var(--fx-cyan) / 44%) 30%, rgb(var(--fx-violet) / 44%) 55%, rgb(var(--fx-pink) / 36%) 78%, transparent 96%) top / 100% 1px no-repeat,
    radial-gradient(ellipse 180px 60px at calc(100% - 40px) 0%, var(--fx-dialog-glint), transparent 100%),
    var(--glass-reflection), var(--glass-dialog);
  -webkit-backdrop-filter: blur(36px) saturate(145%);
  backdrop-filter: blur(36px) saturate(145%);
  box-shadow: var(--fx-lift-dialog), var(--glass-rim), inset -18px 18px 40px -30px rgb(255 255 255 / 40%);
}
html[data-shell="mobile"] .ic-overlay .ic-tab[data-type="separator"] { display: none; }
html[data-shell="mobile"] .ic-overlay .ic-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 6px 12px 2px; }
html[data-shell="mobile"] .ic-overlay .ic-tab { padding: 8px 2px 6px; font-size: 11.5px; min-height: 56px; }
html[data-shell="mobile"] .ic-overlay .ic-tab span { white-space: normal; line-height: 1.15; text-align: center; overflow: visible; }
html[data-shell="mobile"] .ic-overlay .ic-header { padding: 14px 12px 4px 18px; }
html[data-shell="mobile"] .ic-overlay .ic-close { width: var(--mx-hit); height: var(--mx-hit); border-radius: 50%; }
html[data-shell="mobile"] .ic-overlay .ic-body { padding: 10px 16px 4px; }
html[data-shell="mobile"] .ic-overlay .ic-input { font-size: 16px; min-height: var(--mx-hit); }
html[data-shell="mobile"] .ic-overlay .ic-textarea { min-height: 96px; }
html[data-shell="mobile"] .ic-overlay .ic-btn { min-height: var(--mx-hit); font-size: 15px; }
html[data-shell="mobile"] .ic-overlay .ic-seg button { min-height: 36px; padding: 6px 12px; font-size: 13px; }
html[data-shell="mobile"] .ic-overlay .ic-check { min-height: var(--mx-hit); font-size: 14px; }
html[data-shell="mobile"] .ic-overlay .ic-check input { width: 20px; height: 20px; }
/* The reminder's date: typed, with a calendar button (date-field.js, mobile.css §15),
   at the creator's own field height and corner */
html[data-shell="mobile"] .ic-overlay .mx-df { column-gap: 6px; }
html[data-shell="mobile"] .ic-overlay .mx-df-text { height: var(--mx-hit); min-height: var(--mx-hit); border-radius: 12px; }
/* The sticky footer is a real glass slab: the form scrolls under it, never
   through Cancel / Add or the validation hint */
html[data-shell="mobile"] .ic-overlay .ic-footer {
  position: sticky; bottom: 0; z-index: 1;
  flex-wrap: wrap;
  padding: 12px 16px calc(14px + var(--mx-safe-b));
  background: var(--card);
  border-top: 1px solid var(--glass-divider, rgb(127 127 127 / 18%));
}
html[data-fx="v2"][data-shell="mobile"] body[data-style="glass"][data-theme] .ic-overlay .ic-footer {
  background: var(--glass-reflection), var(--glass-dialog);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
}
html[data-shell="mobile"] .ic-overlay .ic-missing { flex-basis: 100%; }
html[data-shell="mobile"] .ic-overlay .ic-footer .ic-btn { flex: 1; }
/* The keyboard is up: the sheet ends at its top */
html[data-shell="mobile"][data-mx-kb] .ic-overlay { height: var(--mx-vvh, 100dvh); }

/* Media library (z 4000, opened from the item creator's Icon tab): pinned to the column, 16px search */
html[data-shell="mobile"] #media-library { left: var(--mx-inline); right: var(--mx-inline); }
html[data-shell="mobile"] #media-library :is(input[type="text"], input[type="search"], input:not([type])) { font-size: 16px; }

/* Quick-link modal (＋ Link, z 10005): a phone-width dialog with 16px inputs */
html[data-shell="mobile"] .quick-link-modal { left: var(--mx-inline); right: var(--mx-inline); }
html[data-shell="mobile"] .quick-link-modal :is(input, textarea) { font-size: 16px; min-height: var(--mx-hit); }
html[data-shell="mobile"] .quick-link-modal button { min-height: var(--mx-hit); }

/* --- 6. Dark ------------------------------------------------------------------------- */
html[data-fx="v2"][data-shell="mobile"] body[data-style="glass"][data-theme="dark"] .ic-overlay .ic-dialog {
  box-shadow: var(--fx-lift-dialog), var(--glass-rim), inset -18px 18px 40px -30px rgb(190 214 255 / 14%);
}
html[data-fx="v2"][data-shell="mobile"] body[data-style="glass"][data-theme="dark"] .mx-search-field:focus-within { box-shadow: 0 0 0 3px rgb(var(--fx-ind-rgb, 22 160 255) / 22%); }
html[data-shell="mobile"] body[data-theme="dark"] .reminder-link-bubble.mx-link-pill { border-color: rgb(255 255 255 / 10%); }

/* --- 7. Sunset -------------------------------------------------------------------------
   Every surface here is built from the glass tokens, which carry the sunset
   tint; sunset-dark .card panes are forced by styles.css like the desktop
   cards. Nothing to restate. */

/* --- 8. Keyframes (transform / opacity only) -------------------------------------------- */
@keyframes mxLinksSpin { to { transform: rotate(360deg); } }

/* --- 9. Accessibility guards ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html[data-shell="mobile"] .mx-viewer-bar { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  html[data-fx="v2"][data-shell="mobile"] body[data-style="glass"][data-theme] .ic-overlay .ic-dialog {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--card);
  }
  html[data-fx="v2"][data-shell="mobile"] body[data-style="glass"][data-theme] .ic-overlay .ic-footer {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--card);
  }
  html[data-shell="mobile"] .mx-viewer-backdrop { background: #000; }
  html[data-shell="mobile"] .mx-viewer-btn {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background-image: linear-gradient(rgb(28 30 34), rgb(28 30 34));
  }
}
@media (forced-colors: active) {
  html[data-shell="mobile"] :is(.mx-card-toggle, .mx-row, .mx-link-pill, .mx-search-field) { outline: 1px solid CanvasText; }
  html[data-shell="mobile"] .mx-icon-sep { background: CanvasText; }
  html[data-shell="mobile"] .mx-viewer { color: CanvasText; }
  html[data-shell="mobile"] .mx-viewer-backdrop { background: Canvas; }
  html[data-shell="mobile"] :is(.mx-viewer-btn, .mx-viewer-pill) { outline: 1px solid ButtonText; color: ButtonText; }
  html[data-shell="mobile"] :is(.mx-viewer-title, .mx-viewer-msg, .mx-viewer-file, .mx-viewer-file .mx-viewer-file-name) { color: CanvasText; }
}

/* --- 10. Landscape phones --------------------------------------------------------------------- */
@media (orientation: landscape) and (max-height: 500px) {
  html[data-shell="mobile"] .unified-icons-group.mx-icon-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  html[data-shell="mobile"] .ic-overlay { padding-top: 4px; }
  html[data-shell="mobile"] .ic-overlay .ic-dialog { max-width: 640px; margin-inline: auto; }
  /* The viewer's bar is thinner: the picture keeps the short side */
  html[data-shell="mobile"] .mx-viewer-bar { padding-top: calc(var(--mx-safe-t) + 2px); padding-bottom: 12px; }
}

/* --- 11. Move to… (item sheet → another section or card) ------------------------------------
   Cards are headings with a small card glyph ("This card" = the item's own card);
   their sections sit indented beneath on a tree rail; a card without sections is one
   row. Static (no animation); colours from tokens. */
html[data-shell="mobile"] .mx-item-move { margin-top: 14px; }
html[data-shell="mobile"] .mx-card-move { margin: 6px auto 0; font-size: 14px; }
html[data-shell="mobile"] .mx-card-move svg { flex: none; }
html[data-shell="mobile"] .mx-move-pick { display: grid; gap: 8px; }
html[data-shell="mobile"] .mx-move-item-sheet .mx-caption { margin: 12px 4px 8px; }
html[data-shell="mobile"] .mx-move-targets { display: grid; gap: 2px; }
html[data-shell="mobile"] .mx-move-card,
html[data-shell="mobile"] .mx-move-target.is-card {
  display: flex; align-items: center; gap: 10px;
}
html[data-shell="mobile"] .mx-move-card::before,
html[data-shell="mobile"] .mx-move-target.is-card::before {
  content: ''; flex: none;
  width: 14px; height: 11px;
  border: 1.5px solid currentColor; border-radius: 3px;
  opacity: 0.5;
}
html[data-shell="mobile"] .mx-move-card {
  margin: 12px 4px 2px;
  font: 700 15px/1.3 'Inter', system-ui, sans-serif;
  color: var(--text);
}
html[data-shell="mobile"] .mx-move-targets > .mx-move-card:first-child { margin-top: 2px; }
html[data-shell="mobile"] .mx-move-card-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-shell="mobile"] .mx-move-card-tag {
  flex: none; margin-left: auto;
  padding: 2px 8px; border-radius: 999px;
  font: 600 11.5px/1.3 'Inter', system-ui, sans-serif;
  color: var(--muted);
  background: rgb(127 127 127 / 14%);
}
html[data-shell="mobile"] .mx-move-target {
  position: relative;
  box-sizing: border-box;
  width: 100%; min-height: var(--mx-hit);
  margin: 0; padding: 8px 14px;
  border: 0; border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: 500 15px/1.3 'Inter', system-ui, sans-serif;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
}
html[data-shell="mobile"] .mx-move-target.is-card { font-weight: 600; padding-left: 4px; }
html[data-shell="mobile"] .mx-move-target:active { background-color: var(--glass-hover); }
html[data-shell="mobile"] .mx-move-target.is-section { padding-left: 40px; }
html[data-shell="mobile"] .mx-move-target.is-section::before,
html[data-shell="mobile"] .mx-move-target.is-section::after {
  content: ''; position: absolute; left: 21px;
  opacity: 0.24; pointer-events: none;
}
html[data-shell="mobile"] .mx-move-target.is-section::before { top: 0; bottom: 0; border-left: 1.5px solid currentColor; }
html[data-shell="mobile"] .mx-move-target.is-section:last-child::before,
html[data-shell="mobile"] .mx-move-target.is-section:has(+ :is(.mx-move-card, .is-card))::before { bottom: 50%; }
html[data-shell="mobile"] .mx-move-target.is-section::after { top: 50%; width: 10px; border-top: 1.5px solid currentColor; }
html[data-shell="mobile"] .mx-move-target.is-top { font-style: italic; color: var(--muted); }
@media (forced-colors: active) {
  html[data-shell="mobile"] .mx-move-target { outline: 1px solid CanvasText; }
}
