
/* ── The thumb dock ──────────────────────────────────────────────────────── */
.ph-dock {
  /* A real row in the shell's grid, not a floating bar. See buildDock() in
     js/phone/phone-view.js for why: nothing can end up underneath a row. */
  display: none;
  align-items: center;
  gap: 8px;
  /* The bar takes a VARIABLE number of buttons (a feature registers one, and
     the transfer widget does), so any fixed width budget is a guess that the
     next feature breaks. Wrapping is the belt to `.ph-acts`'s braces below,
     which is where the real guarantee lives; between them, an overflow costs
     one more row of height instead of quietly pushing a control off screen. */
  flex-wrap: wrap;
  row-gap: 6px;
  margin: 0 -10px;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  background: rgba(10, 12, 14, 0.86);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.is-phone .shell { grid-template-rows: auto minmax(0, 1fr) auto; }
.is-phone .ph-dock { display: flex; }
/* Right-anchored, and that is a safety decision rather than a cosmetic one: a
   mobile browser floats its own control over the bottom-RIGHT corner of the
   page (reported on Android 16 — it covered the dock's tail, which used to be
   the Settings forwarder, the only route to the panel on this chrome). The
   pager is the one control here with a second route — the pages still swipe —
   so it is the one that can afford to be covered. See buildDock(). */
.ph-pages {
  display: none;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex: 0 0 auto;
}
.ph-dock.has-pages .ph-pages { display: flex; }
.ph-page-at {
  min-width: 30px;
  text-align: center;
  font: 600 0.76rem/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color: var(--text-dim, rgba(255, 255, 255, 0.5));
}
/* Left-anchored, so the forwarders keep the same slots whether or not the pager
   is showing, and Settings lands nearer the middle of the bar than either edge.
   `flex: 1` with `min-width: 0` is what lets the buttons give ground before the
   bar ever overflows — the group has to be allowed to shrink for its children's
   own shrinking to mean anything. */
.ph-acts {
  display: flex;
  gap: 4px;
  /* `flex: 1 1 0`, and the ZERO is the part that matters. With an `auto` basis
     the group's hypothetical width is the sum of its buttons at their natural
     size, which is what a browser decides wrapping on — so five labelled
     buttons would push the pager onto a second line on an ordinary 390px phone
     before anything had a chance to shrink. A zero basis makes the group take
     what is left after the pager and share it out. */
  flex: 1 1 0;
  min-width: 0;
  /* The actual no-overflow guarantee. Below roughly 330px the five buttons
     cannot all keep their 44px minimum on one line, and a flex row that cannot
     wrap resolves that by sliding its tail out of view, silently. Here it takes
     a second line. Nothing in this bar may ever be off screen. */
  flex-wrap: wrap;
  row-gap: 4px;
}
.ph-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text, #f2f4f3);
  /* 44px: the smallest target a thumb hits reliably. */
  min-width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.ph-btn:active { background: rgba(255, 255, 255, 0.12); }
.ph-btn:disabled { opacity: 0.3; }

/* ── An action button: the app's own icon, and a word under it ────────────── */
/* The icon is CLONED from the control this forwards to (see dockIcon()), so the
   bar wears the same marks as the topbar instead of Unicode the device font
   decides how to draw. The caption is the other half of the same fix: five
   symbols in a row is a puzzle, five labelled controls is a bar. */
.ph-btn.ph-act {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  position: relative;         /* the mirrored indicator anchors to this */
  /* Each key starts from its caption and they share what is left: "Bit" gives
     up room to "Приложения" or "Einstellungen", which an even row cut at 360px.
     The max keeps a dock with only two buttons from stretching them across half
     the screen. */
  flex: 1 1 auto;
  min-width: 44px;
  max-width: 84px;
  height: 52px;
  padding: 5px 2px 4px;
}
.ph-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 19px;
}
.ph-ico svg {
  width: 19px;
  height: 19px;
  display: block;
  fill: currentColor;
}
/* The glyph fallback, for a surface where the target button (and therefore its
   icon) is not in the document. It is deliberately the exception now. */
.ph-glyph { font-size: 17px; line-height: 19px; }
.ph-lab {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  color: var(--text-dim, rgba(255, 255, 255, 0.62));
}
.ph-btn.ph-act:active .ph-lab { color: var(--text, #f2f4f3); }
/* A registered action (currently: send files) is the primary thing on the dock,
   so it is the one that reads as a button rather than as chrome. */
.ph-btn-action {
  border-color: rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.16);
}
.ph-btn-action .ph-lab { color: var(--text, #f2f4f3); }

/* The mirrored indicator. Same look as the topbar's own dot (UpdateModal.css),
   because it means the same thing: it is the SAME state, shown on the copy of
   the button the user can actually see on a phone. */
.ph-dot {
  position: absolute;
  top: 5px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4d4d;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 9px rgba(255, 77, 77, 0.85);
  animation: upd-dot-pulse 2s ease-in-out infinite;
}
.ph-dot[hidden] { display: none; }
/* The Store's count from the gear (mirrorCount in phone-view.js): the gear's own
   badge class, moved to the icon's corner; the app-update dot keeps the key's. */
.ph-btn.ph-act .ph-count { top: 1px; left: calc(50% + 3px); right: auto; }
.ph-btn.ph-act .ph-count[hidden] { display: none; }

/* The pager's steps stay square: a chevron needs no caption, and the two of
   them are what buys the actions their width. */
.ph-btn.ph-step {
  min-width: 38px;
  width: 38px;
  height: 52px;
  font-size: 20px;
  padding: 0;
}

/* Narrow phones (iPhone SE and most Androids at 360px). Only the paddings and
   the gaps give ground — never the 44px minimum, which is the dimension a thumb
   actually misses, and never the caption, which is what the bar is for. If it
   still does not fit, the dock wraps rather than hiding its tail. */
@media (max-width: 420px) {
  .ph-dock { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .ph-acts { gap: 3px; }
  .ph-btn.ph-step { min-width: 34px; width: 34px; }
  .ph-page-at { min-width: 26px; }
}

/* ── Nothing floats over the dock ────────────────────────────────────────── */
/* The dock is a grid ROW, which settles every argument with things the
   dashboard lays out and none at all with the things it FIXES to the viewport.
   There are eight of those, and three of them (the Discord invite, the Game
   Companion pill, the layout button) sit in the bottom-RIGHT corner — the exact
   corner this file spends its longest comment conceding to the browser. On a
   desktop they float over a wide empty margin; on a 390px phone they land on
   the bar. Reported while a game was running, which is when the Game Companion
   pill appears.
   `--ph-dock-h` is written by measureDock() in js/phone/phone-view.js from the real
   element: the dock wraps to a second line on a narrow screen and grows with
   the safe-area inset, so a constant here would be wrong on some phone. The
   fallback is only for the frame before the first measurement.
   When you add something fixed to the bottom of the viewport, add it here —
   test/phone-dock-render.test.mjs scans the component CSS and fails if a
   bottom-anchored floater is missing from this list.
   A ticker strip at the bottom sits UNDER the dock (Ticker.css pads the shell
   by its height), so everything lifted here climbs over it too. */
.is-phone body { --ph-bottom-lift: 0px; }
.is-phone body.xe-has-ticker.xe-ticker-bottom { --ph-bottom-lift: var(--xe-ticker-h, 34px); }
.is-phone .bm-card,
.is-phone .discord-invite,
.is-phone .gc-pill,
.is-phone .deck-toast,
.is-phone .wn-look,
.is-phone .vpet {
  bottom: calc(var(--ph-dock-h, 64px) + var(--ph-bottom-lift, 0px) + 12px);
}
/* TopbarMinimal.css pins the layout bar with state selectors a list entry cannot outweigh. */
.is-phone body.topbar-minimal.layout-editing:not([data-panel]) .layout-dock {
  bottom: calc(var(--ph-dock-h, 64px) + var(--ph-bottom-lift, 0px) + 12px) !important;
}
/* The "Customize bar" sheet rises from the bottom too; it stays under the top
   bar's own height instead of its usual 82vh. */
.is-phone .tbp {
  bottom: calc(var(--ph-dock-h, 64px) + var(--ph-bottom-lift, 0px) + 8px);
  max-height: calc(100vh - var(--ph-dock-h, 64px) - var(--ph-bottom-lift, 0px) - 72px);
}

/* ── Things that do not belong on a phone ────────────────────────────────── */
/* Layout editing, split by what the stacked view can actually mean.

   GEOMETRY cannot survive here: tiles are drawn in reading order, not at their
   grid coordinates, so a drag moves a tile somewhere nobody can see and the
   corner handle resizes against a width the tile does not have. The overlay is
   hidden for tidiness, but the real refusal is in js/grid/dashboard-grid.js, which
   keeps the grid static while this view is on — the drag handle is the tile
   CONTENT, so hiding an overlay was never going to stop a drag by itself.

   EVERYTHING ELSE is fine and now stays: adding a widget from the dock, hiding
   one, moving one to another page. Hiding those too is what made a screen set
   to a single column look like it could not be edited at all — reported once
   the v4.11.5 "Tile layout" switch let people choose this view on a monitor,
   where there is a whole topbar to reach it from. */
.is-stacked .gs-edit-overlay { display: none !important; }

/* On a PHONE the editor stays out of reach entirely, which is a different
   reason: a 24-column layout is not a thumb job, and the controls are tap
   targets crowded onto a tile that is already narrow. `.layout-fab` is the
   button that OPENS the editor and lives outside `.layout-controls`, so hiding
   only the controls left it floating in the corner offering an editor this view
   refuses to show. */
.is-phone .layout-controls,
.is-phone .layout-fab,
.is-phone .pager-page-btn { display: none !important; }
.is-phone .pager-page-tools { display: none !important; }
/* The home bar is a native-kiosk gesture strip; on a phone it overlaps the dock. */
.is-phone #xenon-home-bar { display: none; }

@media (prefers-reduced-motion: reduce) {
  .ph-btn { transition: none; }
  /* The mirrored update dot pulses; it still has to be VISIBLE, so the
     animation stops rather than the element being hidden with it. */
  .ph-dot { animation: none; }
}
