:root {
  --bg: #ffffff;
  --ink: #1c2321;
  --muted: #667571;
  --line: #e2e8e5;
  --accent: #1b5e20;
  --accent-soft: #e8f2e9;
  --shadow: 0 -2px 24px rgba(20, 40, 30, .16);
  --panel-h: 45vh;
  --safe: env(safe-area-inset-bottom, 0px);
  font-family: system-ui, "Segoe UI", Rubik, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- map ---------- */

#map {
  position: absolute;
  inset: 0 0 var(--panel-h) 0;
  background: #eef1ef;
}

.maplibregl-map { font: inherit; }

.maplibregl-ctrl-attrib { font-size: 10px; direction: ltr; }
.maplibregl-ctrl-attrib-inner { direction: ltr; }

/* Attribution is required, so keep it visible but clear of the floating
 * buttons rather than letting the two overlap. */
.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right { margin-inline-end: 64px; }

/* Waypoint pins are HTML markers, so the label uses the browser's own font
 * and Hebrew renders regardless of the map style's glyph set.
 *
 * The element itself is a point with no size, and both the dot and the label
 * hang off it. MapLibre places a marker by its own box, so a pin built as an
 * ordinary row of [dot][label] gets anchored by an edge of that row - and in
 * RTL the dot sits at the far end of it, a label's width from the coordinate.
 * That is a fixed offset in *screen* pixels, so the pin slid further from its
 * real place the further you zoomed out, and a long name slid further than a
 * short one. Anchoring the point itself is what keeps it still.
 *
 * `absolute` is what MapLibre's own marker class sets, and it has to stay that
 * way: anything else drops the element back into the flow of the map container
 * and the transform then moves it from wherever that put it. */
.pin {
  position: absolute;
  width: 0;
  height: 0;
  cursor: pointer;
}

.pin i {
  position: absolute;
  top: -7px;                  /* half the dot: border-box, so 14px in all */
  left: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #8d6e63;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}

.pin b {
  position: absolute;
  top: 0;
  inset-inline-start: 11px;   /* beside the dot, on the reading side */
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.me {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1a73e8;
  border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(26, 115, 232, .22);
}

/* ---------- the ring around what is selected ----------
 *
 * Choosing a row used to grow that dot a little and fade the others to 45%.
 * That is enough when you already know which dot to look for, and useless in
 * the one case that matters: you tapped the row *because* you cannot find it,
 * and the map answers with forty dots of which one is slightly larger.
 *
 * The ring is white with a dark edge on both sides rather than a colour of its
 * own. Every layer here already owns a hue - purple shortcuts, pink מקום שמור,
 * teal, orange - and a coloured ring would read as one more category. White
 * outlined in near-black belongs to no layer and stays legible over the street
 * map and over the satellite photo alike.
 */
.sel-ring {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;         /* the dot underneath stays tappable */
}

.sel-ring::before,
.sel-ring::after {
  content: '';
  position: absolute;
  /* 42 ולא 36: הסיכה הנבחרת עצמה היא 24 פיקסלים ועוד מסגרת, ובטבעת צרה יותר
   * היא נוגעת בה משני הצדדים ושתיהן נקראות ככתם אחד. הרווח הוא מה שהופך את
   * הטבעת לסימון של הסיכה במקום לחלק ממנה. */
  top: -21px;
  left: -21px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(20, 20, 20, .8), inset 0 0 0 2px rgba(20, 20, 20, .8);
}

/* Two pulses and then still, rather than a ring that beats for ever. The point
 * is to catch the eye on arrival; a permanent animation on the map is a thing
 * you end up wanting to switch off. */
.sel-ring::after {
  animation: sel-pulse 1.3s ease-out 2;
}

@keyframes sel-pulse {
  from { transform: scale(1);   opacity: .85; }
  to   { transform: scale(2.7); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sel-ring::after { animation: none; opacity: 0; }
}

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

.fab {
  position: absolute;
  inset-inline-end: 12px;
  bottom: calc(var(--panel-h) + 14px);
  z-index: 500;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
  transition: bottom .25s ease;
}

/* Three groups rather than one column of five identical circles. Reading up
 * from the thumb: where I am, then the three that only change how the map
 * looks, then the one that leaves the map altogether. The 24px breaks between
 * groups carry that; the 4px inside the middle group keeps its three reading as
 * a single control. Five evenly spaced circles said none of this. */
.fab-2 { bottom: calc(var(--panel-h) + 82px); }
.fab-3 { bottom: calc(var(--panel-h) + 130px); }
.fab-4 { bottom: calc(var(--panel-h) + 178px); }
.fab-5 { bottom: calc(var(--panel-h) + 246px); }

.fab svg { width: 22px; height: 22px; fill: #3c4a45; }
.fab.on svg { fill: var(--accent); }

.fab-3d { font-size: 14px; font-weight: 800; color: #3c4a45; letter-spacing: -.5px; }
.fab.on .fab-3d { color: var(--accent); }

/* Take-off is the only button in the column that is not a map setting, so it is
 * the only one that is not white. The roundel green is the button itself and the
 * F-16 is drawn over it, which is also what makes the canopy a hole: it is the
 * background showing through.
 *
 * Larger than the glyph buttons, because a silhouette with missiles under its
 * wings is not a glyph and turns to mush at 44px. The negative margin cancels
 * the extra 6px on every side, so its centre stays on the column's axis in
 * both layouts without restating a single offset.
 *
 * padding: 0 is not cosmetic. A button ships with 1px 6px of it, and an image
 * that fills the button overflows that content box; Chrome then pins an
 * overflowing grid item to the start edge instead of centring it, which put
 * the jet high and to one side of its own disc. */
#explore {
  width: 56px;
  height: 56px;
  margin: -6px;
  padding: 0;
  background: #009f67;
}
#explore img { width: 100%; height: 100%; display: block; }

/* ---------- the way back from somewhere else ----------
 *
 * Opposite corner from the legend, which is the only other thing living at the
 * top of the map. Hidden unless the map has actually left the moshava, so on an
 * ordinary visit it never exists. */

.go-home {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  z-index: 900;
  max-width: min(62vw, 260px);
  padding: 9px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
}

/* ---------- folding layer sections ---------- */

.lay-cat { border-top: 1px solid var(--line); }
.lay-cat:first-child { border-top: 0; }

.cat-head {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 11px 2px;
  border: 0;
  background: none;
  text-align: start;
}

/* The disclosure triangle, pointing along the reading direction when folded
 * and down when open - the same gesture a file tree makes. */
.cat-tw {
  flex: none;
  width: 0;
  height: 0;
  border-block: 5px solid transparent;
  border-inline-end: 7px solid var(--muted);
  transition: transform .16s ease;
}

.cat-head.open .cat-tw {
  transform: rotate(-90deg);
  transform-origin: 40% 50%;
}

.cat-txt { flex: 1; min-width: 0; }
.cat-nm { display: block; font-size: 15px; font-weight: 700; }
.cat-sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* What is switched on inside a folded section, at a glance. */
.cat-dots { flex: none; display: flex; align-items: center; gap: 3px; }
.cat-dots .lg-dot { width: 9px; height: 9px; }
.cat-dots .lg-dot.line { width: 12px; height: 3px; }

.cat-body { padding-bottom: 6px; }

/* ---------- tap acknowledgement ---------- */

/* Confirmation that a tap landed, painted immediately and independently of the
 * map's own render loop. See `ping` in draft.js for why it is not enough to let
 * the point speak for itself. */
.tap-ping {
  position: absolute;
  z-index: 450;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(27, 94, 32, .25);
  pointer-events: none;
  animation: tap-ping .42s ease-out forwards;
}

@keyframes tap-ping {
  from { transform: scale(.35); opacity: .95; }
  to   { transform: scale(1.9); opacity: 0; }
}

/* Somebody who has asked for less motion still gets the answer, held still. */
@media (prefers-reduced-motion: reduce) {
  .tap-ping { animation: tap-hold .42s linear forwards; }
  @keyframes tap-hold {
    from { opacity: .95; }
    to   { opacity: 0; }
  }
}

/* ---------- trips ---------- */

/* What a walk is made of, in the order it walks it. Numbered, because the
 * order is the route: these are not tags on a trip, they are the trip. */
.trip-chain {
  margin: 6px 0 12px;
  padding-inline-start: 22px;
  list-style: decimal;
}

.trip-chain li { margin: 3px 0; color: var(--muted); font-size: 12.5px; }

.chain-link {
  padding: 2px 0;
  border: 0;
  background: none;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
  text-align: start;
}

.chain-link .rev { font-weight: 400; font-size: 12px; color: var(--muted); }

/* The trip form's difficulty picker: the same swatch rows the colour and layer
 * pickers use, packed onto one line because there are only ever three. */
.picks.tight { display: flex; gap: 6px; }
.picks.tight .pick { flex: 1; justify-content: center; padding: 7px 4px; }
.picks.tight .lay-swatch { min-height: 16px; }

/* The chain of shortcuts, read back in the form before saving. */
.trip-uses { margin-top: -4px; line-height: 1.6; }

/* ---------- the legend ---------- */

/* Top corner opposite the buttons, and a step below the nav and draft bars in
 * the stack: those cover the whole width when they are up, and while you are
 * recording a trail the colours of the conservation layer are not the point. */
.legend {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  z-index: 900;
  max-width: min(62vw, 260px);
  border-radius: 12px;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .22);
  overflow: hidden;
}

.legend-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 11px;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
}

/* Three stacked bars, which is what a legend looks like at 12px. */
.legend-ic {
  flex: none;
  width: 13px;
  height: 11px;
  background:
    linear-gradient(var(--accent) 0 0) 0 0 / 100% 3px no-repeat,
    linear-gradient(#8aa694 0 0) 0 4px / 100% 3px no-repeat,
    linear-gradient(#c2d0c6 0 0) 0 8px / 100% 3px no-repeat;
}

.legend.open .legend-btn { border-bottom: 1px solid var(--line); }

.legend-body {
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding: 8px 11px 10px;
}

.lg-layer {
  margin: 9px 0 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.lg-layer:first-child { margin-top: 1px; }

.lg-rows { margin: 0; padding: 0; list-style: none; }

.lg-rows li {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 0;
  font-size: 12.5px;
  line-height: 1.3;
}

.lg-dot {
  flex: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--c);
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .12);
}

/* The same swatches the map draws: a bar for a layer of trails, dashed when the
 * route is only planned, and a hollow dot for a point whose position is
 * approximate. */
.lg-dot.line {
  width: 15px;
  height: 4px;
  border: 0;
  border-radius: 2px;
  box-shadow: none;
}

.lg-dot.line.dash {
  background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 7px);
}

.lg-dot.approx { background: color-mix(in srgb, var(--c) 30%, #fff); border-color: var(--c); }

.lg-nm { flex: 1; min-width: 0; }
.lg-n { flex: none; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.lg-foot {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}

.lg-foot .lg-dot { margin-top: 2px; }

/* The same key inside the layer sheet, under the layer it belongs to: that is
 * where somebody switches a layer on, and the first moment they can wonder
 * what its colours mean. Only for a layer that is on, or the sheet becomes a
 * wall of twenty-one chips. */
.lay-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: -2px 0 8px;
  padding: 0 26px 0 0;
  list-style: none;
}

.lay-legend li {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- in-app navigation bar ---------- */

.nav {
  position: absolute;
  top: 10px;
  inset-inline: 10px;
  /* The map's own controls sit high in the stack, so anything lower is not
   * just painted under them, it stops receiving clicks. */
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 16px rgba(10, 40, 20, .35);
}

.nav[hidden] { display: none; }

.nav-arrow {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .17);
  /* Rotated from JS: 0deg means "straight ahead". */
  transition: transform .35s ease;
}

.nav-arrow svg { width: 21px; height: 21px; fill: #fff; }

.nav-txt { flex: 1; min-width: 0; line-height: 1.3; }
.nav-txt strong { display: block; font-size: 17px; }

.nav-txt span {
  display: block;
  font-size: 12px;
  opacity: .85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav.on-trail { background: #0f4c1a; }
.nav.stale { background: #6b7a72; }

/* The whole bar re-frames both ends, so it has to look like something you can
 * press. The stop button keeps its own cursor from the button rule above. */
#nav { cursor: pointer; }

/* Push the zoom/compass puck clear of the bar while navigating. */
.nav-active .maplibregl-ctrl-top-left { margin-top: 62px; }

#nav-stop {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .17);
  color: #fff;
  font-size: 20px;
  line-height: 1;
}

/* ---------- panel ---------- */

.panel {
  position: absolute;
  inset: auto 0 0 0;
  height: var(--panel-h);
  z-index: 600;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow);
  padding-bottom: var(--safe);
  transition: height .25s ease;
}

.grip {
  flex: none;
  height: 20px;
  display: grid;
  place-items: center;
  cursor: ns-resize;
  touch-action: none;
}

.grip::before {
  content: "";
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: #cdd6d2;
}

/* The vertical edge is a desktop affair: on a phone the panel is a sheet the
 * full width of the screen, and there is no width to argue about. */
.grip-v { display: none; }

#list-view, #detail-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* `display: flex` beats the hidden attribute's own display:none, so the two
 * views would otherwise stack on top of each other. */
#list-view[hidden], #detail-view[hidden] { display: none; }

.panel-head { flex: none; padding: 0 14px 8px; }

.panel-head h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -.2px;
}

.stats {
  margin: 2px 0 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.controls { display: flex; gap: 8px; flex-wrap: wrap; }

#search {
  flex: 1 1 170px;
  min-width: 0;
  font-size: 15px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7faf9;
  outline-offset: 2px;
}

/* Five buttons no longer fit one phone-width row, and an overflowing row
 * scrolls the whole document sideways rather than only itself. */
.sorts { display: flex; flex-wrap: wrap; gap: 6px; }

.sort {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.sort.on {
  background: var(--accent-soft);
  border-color: #bcd8bf;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- list ---------- */

.list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 0 8px calc(14px + var(--safe));
  list-style: none;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 8px;
  border-radius: 12px;
  cursor: pointer;
}

.row:hover { background: #f4f8f6; }
.row.on { background: var(--accent-soft); }

.row .swatch {
  flex: none;
  width: 4px;
  align-self: stretch;
  min-height: 38px;
  border-radius: 2px;
  background: currentColor;
}

.row .thumb {
  flex: none;
  width: 54px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #eceeed;
}

.row .thumb.empty {
  display: grid;
  place-items: center;
  font-size: 17px;
  opacity: .45;
}

.row .txt { flex: 1; min-width: 0; }

.row .nm {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row .sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-msg {
  padding: 26px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- detail ---------- */

.detail-head {
  flex: none;
  padding: 0 10px 4px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.detail-head .tip {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 6px;
}

.back svg { width: 18px; height: 18px; fill: currentColor; transform: scaleX(-1); }

.detail {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 14px calc(20px + var(--safe));
}

.detail h2 {
  margin: 0 0 6px;
  font-size: 19px;
  line-height: 1.3;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.chip {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f0f4f2;
  color: #48564f;
}

.chip.accent { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.note {
  margin: 0 0 14px;
  font-size: 14.5px;
  line-height: 1.55;
  color: #33403b;
  padding-inline-start: 10px;
  border-inline-start: 3px solid var(--accent-soft);
}

.detail h3 {
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 6px;
}

.gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 9px;
  background: #eceeed;
  cursor: zoom-in;
}

/* ---------- a video among the photos ----------
 *
 * A YouTube thumbnail is a photo like any other, and without a mark on it the
 * only way to find out that a tile plays rather than enlarges is to press it.
 * The play triangle is the one symbol nobody has to be taught. */
.shot { position: relative; display: block; }

.shot.video img { cursor: pointer; }

.shot.video::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(17, 17, 17, .62) center/13px 15px no-repeat;
  /* The triangle is inlined rather than fetched: it is eleven bytes of path,
   * and an external request for it could fail while the tile it explains
   * loaded fine. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  box-shadow: 0 1px 6px rgba(0, 0, 0, .45);
  pointer-events: none;             /* the press belongs to the tile */
}

.acts { display: grid; gap: 7px; }

.act {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  text-decoration: none;
  color: inherit;
  background: #fff;
}

.act:hover { background: #f6faf8; }

/* The primary action: navigate without leaving the app. */
.act-nav {
  width: 100%;
  text-align: start;
  background: var(--accent-soft);
  border-color: #bcd8bf;
}

.act-sub { padding: 8px 12px; }
.act-sub .lbl { font-weight: 500; font-size: 13px; color: var(--muted); }

/* Access points far from any road, where Google may have no panorama. */
.act.weak { border-style: dashed; }
.act.weak svg { fill: #a0aaa5; }
.act.weak .lbl { color: #6a7671; }

.act svg { flex: none; width: 20px; height: 20px; fill: var(--accent); }
.act .lbl { flex: 1; font-size: 14px; font-weight: 600; }
.act .hint { font-size: 11.5px; color: var(--muted); font-weight: 400; display: block; }

.src {
  display: block;
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(8, 14, 11, .99);
  display: flex;
  flex-direction: column;
}

.lightbox[hidden] { display: none; }

/* The tracks must be minmax(0, 1fr), not auto. An auto row is sized by its
 * content, which leaves the image's max-height:100% resolving against an
 * indefinite height - so it is ignored and tall photos overflow off-screen
 * with only the top visible. Definite tracks make the percentage work. */
.lb-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  padding: 44px 12px 4px;
  /* A magnified photo is bigger than the stage by definition, and without this
   * it would spill over the caption and out past the close button. */
  overflow: hidden;
}

#lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  grid-area: 1 / 1;
  /* The wheel handler scales about the centre, and works out its offsets on
   * that assumption. */
  transform-origin: center center;
  cursor: zoom-in;
}

/* Enlarged, the picture is something to move about rather than to magnify
 * further, and the cursor should say so before the drag starts. */
#lb-img.zoomed { cursor: grab; }
#lb-img.zoomed:active { cursor: grabbing; }

#lb-img.loading { opacity: 0; }

/* The player takes the stage the same way a photo does, at 16:9 and as large
 * as fits. `aspect-ratio` with both maxima is what keeps it from being letter-
 * boxed on a wide screen and cropped on a narrow one. */
.lb-video {
  grid-area: 1 / 1;
  width: 100%;
  max-width: min(100%, calc((100vh - 130px) * 16 / 9));
  aspect-ratio: 16 / 9;
  max-height: 100%;
  border: 0;
  border-radius: 4px;
  background: #000;
}

.lb-video[hidden] { display: none; }

.lb-spin {
  grid-area: 1 / 1;
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, .25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.lb-spin[hidden] { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

.lb-close, .lb-nav {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, .13);
  color: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.lb-close {
  top: 10px;
  inset-inline-end: 10px;
  width: 40px;
  height: 40px;
  font-size: 26px;
  line-height: 1;
}

.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  font-size: 30px;
  line-height: 1;
}

.lb-prev { inset-inline-start: 8px; }
.lb-next { inset-inline-end: 8px; }
.lb-nav[hidden] { display: none; }

.lb-cap {
  flex: none;
  margin: 0;
  padding: 10px 16px calc(16px + var(--safe));
  text-align: center;
  color: #dfe6e2;
  font-size: 13.5px;
}

.lb-count { color: #8c9a94; font-size: 12px; }

/* ---------- desktop ---------- */

@media (min-width: 860px) {
  /* One number drives the whole desktop layout: the panel's width, the map's
   * inset, and everything floating over the map. Dragging the edge writes to
   * it, and folding the panel away sets it to zero. */
  :root { --panel-h: 100%; --panel-w: 380px; }

  /* Logical insets keep the panel on the reading-start side (right, in RTL). */
  #map { inset: 0; inset-inline-start: var(--panel-w); }

  .panel {
    inset: 0;
    inset-inline-end: auto;
    width: var(--panel-w);
    height: 100%;
    border-radius: 0;
    box-shadow: 2px 0 20px rgba(20, 40, 30, .12);
    overflow: hidden;            /* folded to zero, the list must not spill out */
  }

  .grip { display: none; }

  .grip-v {
    display: block;
    position: absolute;
    inset-block: 0;
    inset-inline-start: var(--panel-w);
    margin-inline-start: -6px;   /* straddle the seam rather than sit beside it */
    width: 12px;
    z-index: 700;
    cursor: ew-resize;
    touch-action: none;
  }

  .grip-v::before {              /* the seam itself, lit on hover */
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 5px;
    width: 2px;
    background: transparent;
    transition: background .15s ease;
  }

  .grip-v:hover::before,
  .grip-v:focus-visible::before,
  .grip-v.dragging::before { background: var(--accent); }

  /* The tab is the discoverable half: a person who never thinks to drag an
   * edge still sees something to press, and when the panel is folded away
   * this is the only thing left to bring it back. */
  /* The tab hangs off the seam into the map, never into the list, so that when
   * the panel is folded to nothing the tab is still fully on screen. */
  .grip-btn {
    position: absolute;
    top: 50%;
    inset-inline-end: -20px;
    width: 26px;
    height: 46px;
    margin-top: -23px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px 0 0 8px;   /* rounded on the side facing the map (RTL) */
    background: #fff;
    box-shadow: 0 2px 8px rgba(20, 40, 30, .16);
    cursor: pointer;
  }

  /* Two borders of a square, rotated: the arrowhead. The angles are physical
   * because a rotation cannot be expressed logically, and this layout puts the
   * map to the left of the panel. */
  .grip-btn::before {
    content: "";
    display: block;
    width: 7px;
    height: 7px;
    margin: 0 auto;
    border-top: 2px solid #55635e;
    border-inline-start: 2px solid #55635e;
    transform: rotate(-135deg);   /* points at the map: "fold this away" */
  }

  .grip-v:hover .grip-btn { border-color: var(--accent); }
  .grip-v:hover .grip-btn::before { border-color: var(--accent); }

  /* Folded: no panel and nothing to drag, only the tab pointing back at where
   * the list went. The seam stops straddling the edge so the tab stays inside
   * the window. */
  .panel-off { --panel-w: 0px; }
  .panel-off .panel { box-shadow: none; }
  .panel-off .grip-v { cursor: pointer; margin-inline-start: 0; }
  .panel-off .grip-btn::before { transform: rotate(45deg); }

  /* Dragging a width while the map animates its own is a fight nobody wins. */
  .panel, #map, .fab, .nav { transition: none; }
  .panel-anim .panel, .panel-anim #map,
  .panel-anim .fab, .panel-anim .grip-v { transition: all .22s ease; }

  .panel-head { padding-top: 16px; }
  /* The .fab rule above resets every button to 20px, so each position has to be
   * restated here. .fab-5 was not, which dropped the flight button exactly on
   * top of "where am I" and swallowed it without a trace. */
  .fab { bottom: 20px; inset-inline-end: auto;
         inset-inline-start: calc(var(--panel-w) + 20px); }
  .fab-2 { bottom: 88px; }
  .fab-3 { bottom: 136px; }
  .fab-4 { bottom: 184px; }
  .fab-5 { bottom: 252px; }

  .sheet { align-items: center; }
  .sheet-card { max-width: 460px; border-radius: 16px; margin: 0 16px; }

  /* The bars are positioned against the window, not the map, so at this width
   * they would lie across the panel. Inline-start is the panel's side. */
  .nav { inset-inline: calc(var(--panel-w) + 10px) 10px; }

  /* Clear of the fold tab, which hangs 26px off the seam into the map at the
   * height an open legend reaches. At +10px the legend swallowed the only
   * control that brings a folded panel back. */
  .legend { inset-inline-start: calc(var(--panel-w) + 38px); }
}

.no-gl {
  margin: 0;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- layer and draft badges ---------- */

.tag {
  display: inline-block;
  vertical-align: 1px;
  margin-inline-end: 5px;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  background: var(--c, var(--muted));
}

/* A private layer, and every row that comes out of one. Dark rather than in the
 * layer's colour, and with the padlock drawn in, so it reads as a state and not
 * as one more layer colour among the others. */
.tag.lock {
  background: #37474f;
  padding-inline-start: 5px;
}
.chip.lock { background: #37474f; color: #fff; font-weight: 600; }
.tag.lock::before, .chip.lock::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-inline-end: 3px;
  vertical-align: -1px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 8h-1V6a5 5 0 0 0-10 0v2H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2zM9 6a3 3 0 0 1 6 0v2H9V6z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 8h-1V6a5 5 0 0 0-10 0v2H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2zM9 6a3 3 0 0 1 6 0v2H9V6z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.chip.layer {
  background: color-mix(in srgb, var(--c) 15%, #fff);
  color: color-mix(in srgb, var(--c) 78%, #000);
  font-weight: 600;
}

/* ---------- bottom sheet ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(12, 22, 17, .45);
}

.sheet[hidden] { display: none; }

.sheet-card {
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  padding: 4px 16px calc(20px + var(--safe));
  box-shadow: 0 -4px 30px rgba(10, 30, 20, .3);
}

.sheet-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 0 6px;
  background: var(--bg);
}

.sheet-head h2 { margin: 0; font-size: 18px; }

.sheet-x {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f0f4f2;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}

.sheet-lead {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}

.sheet-credit {
  margin: 14px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- layer rows ---------- */

.lay {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
}

.lay.on { border-color: #bcd8bf; background: #f7fbf8; }
.lay input { flex: none; width: 19px; height: 19px; margin: 2px 0 0; accent-color: var(--accent); }

.lay-swatch {
  flex: none;
  width: 4px;
  align-self: stretch;
  min-height: 34px;
  border-radius: 2px;
  background: var(--c);
}

/* A dashed swatch carries the same meaning as the dashed line on the map:
 * planned, or not published yet. */
.lay-swatch.dash {
  background: repeating-linear-gradient(var(--c) 0 5px, transparent 5px 9px);
}

.lay-txt { flex: 1; min-width: 0; }
.lay-nm { display: block; font-size: 14.5px; font-weight: 600; }
.lay-sub { display: block; font-size: 12px; color: var(--accent); margin-top: 1px; }
.lay-note { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.45; margin-top: 3px; }
.lay-note a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- the invitation in the list header ----------
 *
 * Full width and in the accent colour, because it is not one of the controls
 * around it: the sort chips change what you are looking at, and this one is the
 * only thing on the panel that adds to the map. It sits above the search rather
 * than below it so that it is on screen when the panel is at its shortest. */

.invite {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #bcd8bf;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  text-align: start;
}

.invite:active { background: #ddebde; }

.invite-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
}

.invite-ic svg { width: 20px; height: 20px; fill: #fff; }

.invite-txt { min-width: 0; }
.invite-txt b { display: block; font-size: 14.5px; }

.invite-txt > span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.45;
  color: #3f6b45;
}

/* Once there is an unsent draft on the device, the explainer has done its job
 * and the panel needs the room back. See paintUnsent(). */
.invite.compact { padding: 8px 12px; }
.invite.compact .invite-txt > span { display: none; }
.invite.compact .invite-ic { width: 26px; height: 26px; }
.invite.compact .invite-ic svg { width: 17px; height: 17px; }

/* Unsent work, in the drafts' own purple so that the strip, the badge on the
 * row and the dashed line on the map are one colour and one idea. Below the
 * invitation rather than instead of it: somebody with an unsent trail may well
 * be about to record a second one. */
.unsent {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 10px;
  padding: 9px 12px;
  border: 1px solid #e0c4e8;
  border-radius: 12px;
  background: #f8effa;
  color: #5c2b6b;
  text-align: start;
}

.unsent[hidden] { display: none; }
.unsent:active { background: #f0e0f5; }
.unsent-ic { flex: none; font-size: 19px; line-height: 1; }
.unsent-txt { min-width: 0; }
.unsent-txt b { display: block; font-size: 13.5px; color: #4a148c; }

.unsent-txt > span {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  line-height: 1.45;
}

/* ---------- drafting ---------- */

.draft-bar { background: #6a1b9a; }
.draft-bar.paused { background: #5c6b64; }

.draft-dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5252;
  box-shadow: 0 0 0 4px rgba(255, 82, 82, .3);
  animation: pulse 1.4s ease-in-out infinite;
}

.draft-bar.paused .draft-dot { background: #cfd8d4; box-shadow: none; animation: none; }

@keyframes pulse {
  50% { opacity: .35; }
}

.draft-btn {
  flex: none;
  border: 0;
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, .18);
}

.draft-btn.strong { background: #fff; color: #6a1b9a; }
.draft-btn[disabled] { opacity: .4; }
.draft-btn[hidden] { display: none; }

#draft-cancel {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .17);
  color: #fff;
  font-size: 20px;
  line-height: 1;
}

/* While placing points, a tap on the map means "add a vertex", so the panel
 * gets out of the way rather than covering the trail being drawn. */
.drafting { --panel-h: 96px; }
.drafting .maplibregl-ctrl-top-left { margin-top: 62px; }

/* ---------- draft forms ---------- */

.big-act {
  display: block;
  width: 100%;
  text-align: start;
  margin-bottom: 9px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.big-act b { display: block; font-size: 15px; }
.big-act span { display: block; margin-top: 3px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.big-act.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.big-act.primary span { color: rgba(255, 255, 255, .8); }
.big-act.ghost { background: #f7faf9; }

.fld { display: block; margin-bottom: 12px; }
.fld > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }

.fld input, .fld textarea {
  width: 100%;
  font: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7faf9;
  resize: vertical;
}

.act.danger .lbl { color: #b3261e; }

.landed {
  margin: 12px 0 0;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  line-height: 1.5;
}

/* ---------- editor mode ---------- */

.title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.editor-btn {
  flex: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--muted);
}

.editor-btn.on {
  border-color: #bcd8bf;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.steps {
  margin: 0 0 14px;
  padding-inline-start: 20px;
  font-size: 13px;
  line-height: 1.7;
  color: #3a4741;
}

/* The setting names are English inside Hebrew instructions. Mixed on one line
 * they are genuinely hard to read, and the bidi algorithm moves the separators
 * to the wrong end, so each one gets its own left-to-right block. */
.steps code {
  display: block;
  direction: ltr;
  text-align: left;
  margin: 4px 0;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #eef2f0;
  color: #33403b;
}

.steps a { color: var(--accent); }

.tok-err, .pub-msg {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  line-height: 1.5;
}

.tok-err { background: #fdecea; color: #b3261e; }
.pub-msg.bad { background: #fdecea; color: #b3261e; }
.tok-err[hidden], .pub-msg[hidden] { display: none; }

/* ---------- links on an item ---------- */

.act-link { align-items: center; }
.act-link .lbl { font-weight: 600; }

/* A URL is left-to-right inside a right-to-left line, and without an explicit
 * direction the bidi algorithm drags the scheme and the path apart. */
.act-link .hint {
  direction: ltr;
  text-align: start;
  unicode-bidi: isolate;
}

.link-rows { display: grid; gap: 8px; margin-bottom: 8px; }

.link-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
  align-items: center;
}

.link-row input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7faf9;
  min-width: 0;
}

.link-row .l-url { direction: ltr; text-align: left; }

.link-x {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: #f0f4f2;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
}

.add-row {
  border: 1px dashed var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 12px;
}

/* Two text fields side by side stop being fillable somewhere around here. */
@media (max-width: 420px) {
  .link-row { grid-template-columns: 1fr auto; }
  .link-row .l-title { grid-column: 1; }
  .link-row .link-x { grid-row: 1 / span 2; }
}

/* ---------- colour picker and radio picks ---------- */

.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.sw {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--c);
  box-shadow: 0 0 0 1px var(--line);
}

.sw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--ink); }

/* "whatever the layer is": a swatch with no colour of its own. */
.sw.none {
  background:
    linear-gradient(45deg, transparent 45%, var(--line) 45%,
                    var(--line) 55%, transparent 55%), #fff;
}

/* The colour a trail is currently drawn in, shown on the button that opens
 * the picker so the choice is visible before it is opened. */
.hint .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
  vertical-align: baseline;
  margin-inline-end: 3px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #3a4741;
}

.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.picks { display: grid; gap: 7px; margin-bottom: 12px; }

.pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
}

.pick.on { border-color: #bcd8bf; background: #f7fbf8; }
.pick input { width: 18px; height: 18px; accent-color: var(--accent); }
.pick .lay-swatch { min-height: 20px; }

/* ---------- layer management ---------- */

.lay-row { display: flex; align-items: stretch; gap: 6px; }
.lay-row .lay { flex: 1; min-width: 0; }

.lay-edit {
  flex: none;
  align-self: center;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11.5px;
  color: var(--muted);
}

/* Above every category, and neutral rather than green: it undoes work instead
 * of adding any, and it should not compete with the layer names underneath it
 * for the eye that came here to switch something on. */
.lay-clear {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  margin: 0 0 10px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}

.lay-clear-n { font-weight: 400; font-size: 11.5px; }

.lay-add {
  display: block;
  width: 100%;
  border: 1px dashed #bcd8bf;
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 11px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 2px;
}

/* Sits directly under the places row and carries that layer's colour, so it
 * reads as an action on the layer above it rather than a stray control. */
.lay-add.places {
  border-style: solid;
  border-color: #d8bde3;
  background: #f7f0fa;
  color: #6a1b9a;
  margin: -4px 0 10px;
}

/* ---------- a layer's own pictures and clips ----------
 *
 * Indented under the row it belongs to and drawn smaller than the detail
 * pane's gallery: the sheet is a list of fifteen layers, and tiles at the
 * pane's size would turn scanning it into scrolling past photographs. Small
 * enough to read as a property of the row, large enough that the play triangle
 * on a clip is still the obvious thing to press. */
/* Pulled up under the row it belongs to and indented to the width of that
 * row's checkbox, the way the legend chips are. Without both it floats between
 * two layer cards and reads as if it belonged to the one below. */
.lay-media {
  margin: -6px 0 12px;
  padding: 0 26px 0 0;
}

.lay-media .gallery {
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 5px;
}

.lay-media .gallery img { border-radius: 7px; }
.lay-media .shot.video::after { width: 28px; height: 28px; background-size: 10px 12px; }
.lay-media .shot-x { width: 19px; height: 19px; font-size: 13px; }

.lay-media-acts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}

.lay-media-acts .lay-edit { margin-bottom: 0; cursor: pointer; }

/* ---------- removable photos ---------- */

.gallery .shot { position: relative; display: inline-flex; }

.shot-x {
  position: absolute;
  inset-block-start: 4px;
  inset-inline-end: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 25, 22, .62);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  backdrop-filter: blur(2px);
}

/* ---------- places ---------- */

.addr {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.unplaced {
  margin: 4px 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff8e6;
  color: #7a5b12;
  font-size: 13px;
  line-height: 1.55;
}

/* ---------- a draft, and the one button that ends it ----------
 *
 * The band is in the purple the drafts are drawn in on the map, so that the
 * dashed line, the badge on the row and this paragraph are visibly the same
 * thing. It is the first element in the pane, above the send button, because
 * the button only makes sense once you know the trail is nowhere yet. */
.draft-state {
  margin: 4px 0 12px;
  padding: 11px 13px;
  border-inline-start: 4px solid #8e24aa;
  border-radius: 10px;
  background: #f8effa;
  color: #5c2b6b;
  font-size: 13.5px;
  line-height: 1.6;
}

.draft-state b { display: block; color: #4a148c; font-size: 14.5px; margin-bottom: 2px; }

/* Full width, filled, and the only filled thing on the page. Everything else a
 * draft offers is an outlined row, so this is not "the first of six actions"
 * but the action, and the six are what you do before or instead of it. */
.send-cta {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  margin-bottom: 10px;
  padding: 13px 14px;
  border: 0;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  text-align: start;
  box-shadow: 0 2px 10px rgba(27, 94, 32, .25);
}

.send-cta:active { background: #164a1a; }
.send-cta[disabled] { background: #7f8f86; box-shadow: none; }

.send-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
}

.send-ic svg { width: 20px; height: 20px; fill: #fff; }

.send-txt { min-width: 0; }
.send-txt b { display: block; font-size: 15.5px; }

.send-txt > span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255, 255, 255, .85);
}

/* The sender's own trail, waiting. The same yellow the queue is drawn in on the
 * map, with a band down the leading edge so the pane opens on it rather than on
 * one more paragraph: this is the answer to "where did my trail go", and it has
 * to be the first thing read. */
.waiting {
  margin: 4px 0 14px;
  padding: 11px 13px;
  border-inline-start: 4px solid #f9a825;
  border-radius: 10px;
  background: #fff8e6;
  color: #7a5b12;
  font-size: 13.5px;
  line-height: 1.6;
}

.waiting b { color: #6b4e0a; }

/* ---------- arranging places ---------- */

.arrange-bar {
  background: #7b1fa2;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.arrange-bar .draft-btn.strong { color: #7b1fa2; }
.arrange-row { display: flex; align-items: center; gap: 10px; }
.arrange-row.second { gap: 8px; }
.pin-dot { flex: none; font-size: 20px; line-height: 1; }

/* `.nav-txt span` makes every span a full-width block with an ellipsis, which
 * is right for the navigation bar's one line of status and wrong for a row of
 * links and flags - the flag stretched across the whole bar. */
.nav-txt .arrange-links,
.nav-txt .arrange-links > * {
  display: inline-flex;
  align-items: center;
  width: auto;
  overflow: visible;
  opacity: 1;
}

.arrange-links {
  gap: 10px;
  flex-wrap: wrap;
  white-space: normal;
}

.arrange-links a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 11.5px;
}

.am-hint { font-size: 11.5px; color: rgba(255, 255, 255, .78); }

.am-flag {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
}

.am-flag.warn { background: rgba(255, 214, 0, .3); }
.arrange-count { font-size: 11px; color: rgba(255, 255, 255, .78); }

#arrange-done {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .17);
  color: #fff;
  font-size: 20px;
  line-height: 1;
}

/* Same reasoning as .drafting: while the map is what you are working on, it
 * has to be the thing you can see. */
.arranging { --panel-h: 128px; }
.arranging .maplibregl-ctrl-top-left { margin-top: 96px; }

/* ---------- a draggable place marker ---------- */

/* Built like .pin above, and for the same reason: the element is the point,
 * and the dot sits on it rather than a label's width away. Here it matters
 * twice over, because a drag stores wherever the pointer was - so a dot drawn
 * off to one side would pin the place somewhere nobody aimed at. */
.am {
  position: absolute;      /* MapLibre's own; see .pin */
  width: 0;
  height: 0;
  /* Only the dot should be grabbable: these pins sit very close together, and
   * a label wide enough to read covers the dot of the pin next door. */
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.am i {
  position: absolute;
  top: -7.5px;                /* half the dot: border-box, so 15px in all */
  left: -7.5px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--c);
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
  pointer-events: auto;
  cursor: grab;
  /* Without this the browser claims the gesture for scrolling and the pin
   * never receives a pointermove on a touchscreen. */
  touch-action: none;
}

/* A fingertip is far bigger than fifteen pixels, so the dot reaches further
 * than it looks - but still nothing like as far as the label. */
.am i::after {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 50%;
}

.am b {
  position: absolute;
  top: 0;
  inset-inline-start: 12px;   /* beside the dot, on the reading side */
  transform: translateY(-50%);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  color: #23282b;
  background: rgba(255, 255, 255, .88);
  padding: 1px 5px;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  pointer-events: none;
}

/* A guessed position is the one most likely to be wrong, so it is the one that
 * should catch the eye of whoever is fixing them. */
.am.approx i { border-style: dashed; border-color: #ffd54f; }

.am.moved i { background: #7b1fa2; box-shadow: 0 0 0 4px rgba(123, 31, 162, .3); }
.am.moved b { background: #7b1fa2; color: #fff; }
.am.on i { transform: scale(1.25); }
.am.on b { outline: 2px solid #7b1fa2; }

.am.drag { z-index: 5; }
.am.drag i { cursor: grabbing; }
.am.drag i { transform: scale(1.4); box-shadow: 0 3px 10px rgba(0, 0, 0, .5); }

.am.fresh i { animation: drop 1.2s ease-out; }

@keyframes drop {
  0% { transform: scale(2.2); }
  60% { transform: scale(1); }
}

/* Nothing else on the map should react while a pin is being carried. */
.am-dragging .maplibregl-canvas { cursor: grabbing; }
.am-dragging .am:not(.drag) i { pointer-events: none; opacity: .75; }

/* ---------- מצב תעופה - exploration mode ----------
 *
 * A different world from the rest of the app, on purpose. Everything else here
 * is a bright document you read; this is a dark screen you fly through, and
 * the only thing lit is what you have found.
 *
 * The stacking order is the whole trick, and it puts the map in the middle of
 * our own elements rather than under all of them:
 *
 *     1  .fly-sky     the gradient above the horizon, seen through the map
 *     2  #map         satellite tiles, transparent where there is no ground
 *     3  .fly-world   haze, name chips, the floating photos
 *     4  .fly-rush    speed streaks   5 .fly-vig  vignette
 *     6  .fly-hud     gauges and buttons        7 intro   8 the open photo
 *
 * `display: contents` on the root is what allows it: the children take part in
 * the page's own stacking context, so a sky of ours can sit *behind* a map
 * that is not ours. A positioned wrapper would trap all of them above it.
 *
 * The map hangs past the screen by --fly-oy above and below and --fly-ox at
 * the sides, so that rolling the picture has material to cover the corners
 * with. explore.js sets them to make the map a square the size of the
 * screen's diagonal, which covers the screen at any angle at all - a full
 * roll included - and sets both to 0 on touch screens, where nothing rolls
 * and nothing should be paid for. */

.fly-root { display: contents; }
body:not(.flying) .fly-root > * { display: none !important; }

/* The cursor is the stick, so it is drawn as a sight and not as a hand: there
 * is nothing here to grab.
 *
 * The ground colour is what shows wherever nothing has been painted yet - a
 * satellite tile still on its way, a corner of a rotating layer Chrome has
 * not rasterised in time. Black there reads as a hole in the world; a dark
 * earth reads as ground the light has not reached, which is a thing a
 * landscape at dusk is allowed to have. */
body.flying {
  background: #23261e;
  cursor: crosshair;
}

/* Everything the app normally shows is gone. The GL layers are hidden by
 * explore.js, which can put back what it found; these are the DOM pieces. */
body.flying .panel,
body.flying .grip-v,
body.flying .fab,
body.flying .legend,
body.flying .go-home,
body.flying .nav,
body.flying .lightbox,
body.flying .sheet,
body.flying .maplibregl-control-container,
body.flying .maplibregl-marker { display: none !important; }

/* `fixed` and not `absolute`, and that is not a detail: an absolutely
 * positioned box that hangs past the left of the viewport *extends the
 * document's scrollable width*, and this document is RTL, where the scroll
 * origin sits at the right. The result was the leftmost 8% of the screen
 * falling outside the painted map and showing the white page behind it. A
 * fixed box contributes no scrollable overflow at all, so the overhang is
 * simply clipped, which is what it was always meant to be. */
body.flying #map {
  position: fixed;
  inset: calc(-1 * var(--fly-oy, 0px)) calc(-1 * var(--fly-ox, 0px));
  z-index: 2;
  background: transparent;
  will-change: transform;
}

/* ---------- sky ---------- */

.fly-sky {
  position: fixed;
  inset: calc(-1 * var(--fly-oy, 0px)) calc(-1 * var(--fly-ox, 0px));
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  background: #23261e;     /* the ground, under any tile that has not arrived */
  will-change: transform;
}

/* A fixed-height gradient slid up and down so that its pale end lands
 * exactly on the horizon. Slid, not resized: its transform is set every
 * frame and a transform costs the compositor nothing, where a height change
 * is a repaint of a strip as wide as the map. Its height is BAND_H in
 * explore.js and the two must agree. Late afternoon, because that is when
 * this walk is worth taking. */
.fly-band {
  position: absolute;
  inset: 0 0 auto 0;
  height: 600px;
  background: linear-gradient(to bottom,
    #0f2744 0%, #1d4a78 26%, #4a86b8 54%, #97c0da 76%, #dcd2b4 93%, #efe0be 100%);
  will-change: transform;
}

/* ---------- the world layer ---------- */

.fly-world {
  position: fixed;
  inset: calc(-1 * var(--fly-oy, 0px)) calc(-1 * var(--fly-ox, 0px));
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  will-change: transform;
}

/* Where the furthest tiles stop there is an edge, and at this tilt it is right
 * across the middle of the picture. A band of the sky's own colour, sitting in
 * front of the map, turns that edge into distance. */
.fly-haze {
  position: absolute;
  top: 0;                   /* moved with a transform, see paintHud */
  left: -10%;
  width: 120%;
  height: 170px;
  will-change: transform;
  background: linear-gradient(to bottom,
    rgba(226, 219, 196, .92) 0%, rgba(214, 214, 198, .55) 34%, rgba(200, 210, 200, 0) 100%);
}

/* ---------- a photo hanging over its trail ---------- */

.fly-card {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);   /* explore.js prepends the position */
  pointer-events: auto;
  will-change: transform;
  cursor: zoom-in;
  border-radius: 7px;
  padding: 4px 4px 0;
  background: linear-gradient(#fffdf6, #f2ece0);
  box-shadow:
    0 0 0 1px rgba(255, 245, 210, .55),
    0 10px 26px rgba(0, 0, 0, .55),
    0 0 40px rgba(255, 208, 120, .28);
  transition: opacity .18s linear;
}
.fly-card[hidden] { display: none; }

/* The card's click target, 18px wider than the card on every side. Absolute
 * children may hang outside their parent's box and still take its clicks,
 * which is the whole trick; nothing is painted here. */
.fly-card-hit {
  position: absolute;
  inset: -18px;
  pointer-events: auto;
}

.fly-card-img {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 4px;
  background: #2a2f33;
}
.fly-card-img img { display: block; width: 100%; height: 100%; object-fit: cover; }

.fly-card-cap {
  padding: 3px 4px 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  color: #33403a;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Far enough away that the name would be a smudge, so it goes and the picture
 * stays - a distant card is a promise, not a label. */
.fly-card.small { padding: 3px; }
.fly-card.small .fly-card-cap { display: none; }

/* A video floats as its thumbnail, with a play mark so it is not mistaken for
 * a photograph of a place that happens to have a red button in it. */
.fly-card.video .fly-card-img::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34%;
  max-width: 44px;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(10, 14, 12, .62);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .85);
}
.fly-card.video .fly-card-img { position: relative; }
.fly-card.video .fly-card-img::before {
  content: '';
  position: absolute;
  left: 54%;
  top: 50%;
  z-index: 1;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent #fff;
}
.fly-card.small.video .fly-card-img::before { border-width: 4px 0 4px 7px; }

/* The tether, and the point on the ground it belongs to. Without them a photo
 * floats over the landscape attached to nothing, which is exactly the thing a
 * map must not do. */
.fly-card::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  width: 2px;
  height: var(--tether, 0px);
  transform: translateX(-50%);
  background: linear-gradient(to bottom,
    rgba(255, 226, 158, .95), rgba(255, 214, 130, .15));
}

.fly-card::before {
  content: '';
  position: absolute;
  top: calc(100% + var(--tether, 0px));
  left: 50%;
  width: 9px;
  height: 9px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: #ffe6a8;
  box-shadow: 0 0 10px 3px rgba(255, 205, 110, .75);
}

/* ---------- the name of a trail you are on top of ---------- */

.fly-chip {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -175%);   /* explore.js prepends the position */
  will-change: transform;
  padding: 3px 11px;
  border-radius: 999px;
  /* No backdrop blur: a blur has to read the map back through a layer that
   * is rotating every frame, and a handful of them was a measurable share
   * of the frame. A little more opacity does the same job for the eye. */
  background: rgba(12, 20, 16, .74);
  color: #fff6df;
  font-weight: 800;
  letter-spacing: -.2px;
  white-space: nowrap;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .9);
  box-shadow: 0 0 0 1px rgba(255, 219, 150, .35), 0 0 24px rgba(255, 197, 92, .3);
  transition: opacity .2s linear;
}

/* ---------- speed, and the edges of the picture ---------- */

/* Streaks radiating from the middle of the screen, which at this tilt is very
 * nearly where you are heading. Opacity follows the throttle, so it is only
 * ever there when it is earned. */
/* Registered so the colour can transition; an unregistered custom property
 * snaps. Browsers without @property still get the colour, only instantly. */
@property --rush {
  syntax: '<color>';
  inherits: false;
  initial-value: rgba(255, 255, 255, .55);
}

.fly-rush {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  --rush: rgba(255, 255, 255, .55);
  background: repeating-conic-gradient(from 0deg at 50% 48%,
    var(--rush) 0deg .16deg, transparent .16deg 2.4deg);
  -webkit-mask-image: radial-gradient(circle at 50% 48%, transparent 26%, #000 78%);
  mask-image: radial-gradient(circle at 50% 48%, transparent 26%, #000 78%);
  transition: opacity .3s linear, --rush .3s linear;
}
/* Under the afterburner the streaks warm up: the same speed, seen through
 * the exhaust. */
body.fly-burn .fly-rush { --rush: rgba(255, 196, 120, .8); }

/* The burner itself, a glow rising from the bottom of the screen where the
 * exhaust would be. Opacity is set by explore.js from the eased burner value,
 * so it breathes in and out with the key rather than switching. */
.fly-burner {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse 70% 38% at 50% 108%,
    rgba(255, 150, 60, .55) 0%, rgba(255, 110, 40, .28) 40%, rgba(255, 90, 30, 0) 100%);
}

.fly-vig {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 52%,
    transparent 46%, rgba(0, 0, 0, .28) 78%, rgba(0, 0, 0, .62) 100%);
}

/* ---------- instruments ---------- */

.fly-hud {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  color: #eef4f2;
}

/* A scrim under the bottom of the screen. The instruments sit over whatever
 * the flight happens to be passing at that moment - a white roof, a field, a
 * photo card - and without this the name of what you found is legible over
 * some of them and not others. */
.fly-hud::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 140px;
  background: linear-gradient(to top, rgba(3, 8, 6, .62), rgba(3, 8, 6, 0));
  pointer-events: none;
}
.fly-hud > * { z-index: 1; }
.fly-hud button { pointer-events: auto; }

/* The dead zone, drawn: a ring at the middle of the screen inside which the
 * mouse asks for nothing. Faint on purpose - it is a reference for the hand,
 * not a target for the eye, and a bright crosshair would turn the flight
 * into a shooting gallery. */
.fly-reticle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28), 0 0 0 1px rgba(0, 0, 0, .25);
  pointer-events: none;
}
.fly-reticle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
}
/* Until the cursor has passed through the ring the stick is not engaged, and
 * the ring says so by breathing: it is asking to be entered. */
body.fly-unarmed .fly-reticle {
  box-shadow: inset 0 0 0 2px rgba(255, 220, 150, .85), 0 0 18px rgba(255, 200, 100, .45);
  animation: fly-arm 1.4s ease-in-out infinite;
}
@keyframes fly-arm {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.18); }
}
/* Touch has no cursor to centre. */
@media (pointer: coarse) { .fly-reticle { display: none; } }

.fly-readout {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  inset-inline-start: 16px;
  display: flex;
  gap: 18px;
}

.fly-gauge { display: flex; flex-direction: column; line-height: 1.1; }
.fly-gauge b {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .8);
}
.fly-gauge i {
  font-style: normal;
  font-size: 10px;
  letter-spacing: .4px;
  opacity: .62;
}
.fly-gauge.burn b { color: #ffb066; }
.fly-gauge.burn[hidden] { display: none; }

/* The throttle, under the gauges: what the button has set, which the speed
 * only follows. The upper part of the track is tinted where the burner
 * lives, so the press that lights it is seen coming. */
.fly-thr {
  position: absolute;
  top: calc(60px + env(safe-area-inset-top, 0px));
  inset-inline-start: 16px;
  width: 128px;
  height: 5px;
  border-radius: 3px;
  /* RTL: the fill grows from the right, so the burner's share is the left. */
  background: linear-gradient(to left,
    rgba(255, 255, 255, .16) 0 48%, rgba(255, 176, 102, .28) 48% 100%);
  overflow: hidden;
}
.fly-thr i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: #eef4f2;
  transition: background-color .25s linear;
}
body.fly-burn .fly-thr i { background: #ffb066; }
@media (pointer: coarse) { .fly-thr { width: 96px; } }

.fly-x, .fly-help, .fly-snd {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(10, 16, 14, .5);
  backdrop-filter: blur(4px);
  color: #eef4f2;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.fly-x { inset-inline-end: 14px; font-size: 24px; line-height: 1; }
.fly-help { inset-inline-end: 60px; font-size: 16px; font-weight: 700; }
.fly-snd { inset-inline-end: 106px; }
.fly-x:hover, .fly-help:hover, .fly-snd:hover { background: rgba(30, 44, 38, .78); }

/* One icon, two states: the waves when the engine can be heard, a cross when
 * it has been muted. */
.fly-snd svg { width: 20px; height: 20px; fill: currentColor; }
.fly-snd .snd-off { display: none; }
.fly-snd.off .snd-wave { display: none; }
.fly-snd.off .snd-off { display: block; }
.fly-snd.off { opacity: .7; }

/* What you have found, named, at the bottom where it does not sit over the
 * thing it names. */
.fly-found {
  position: absolute;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  inset-inline: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
}
.fly-found strong {
  font-size: 17px;
  font-weight: 800;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .9);
}
/* The key is drawn as a key rather than set as English words inside a Hebrew
 * line, which is both easier to read and easier to obey. */
.fly-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  letter-spacing: .3px;
  opacity: .72;
}
/* The display rule above outranks the browser's own [hidden], so without
 * this the hint stayed on screen with nothing found under it. */
.fly-hint[hidden] { display: none; }
.fly-hint kbd {
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .26);
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  direction: ltr;
}
/* Enter shows pictures when there are any and opens the page when there are
 * not; the hint says which, and only one of the two is ever visible. */
.fly-hint > span { display: inline-flex; align-items: center; gap: 7px; }
.fly-hint .hint-open, .fly-hint.open .hint-media { display: none; }
.fly-hint.open .hint-open { display: inline-flex; }

.fly-credit {
  position: absolute;
  bottom: 6px;
  inset-inline-start: 12px;
  margin: 0;
  font-size: 9.5px;
  opacity: .6;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9);
  direction: ltr;
}

/* ---------- how to fly ---------- */

.fly-intro[hidden] { display: none; }

.fly-intro {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  background: rgba(4, 8, 10, .5);
  backdrop-filter: blur(2px);
  animation: fly-in .35s ease both;
}

@keyframes fly-in { from { opacity: 0; } to { opacity: 1; } }

.fly-intro-card {
  max-width: min(92vw, 400px);
  padding: 24px 26px 20px;
  border-radius: 16px;
  background: rgba(14, 22, 20, .9);
  box-shadow: inset 0 0 0 1px rgba(255, 220, 150, .22), 0 24px 60px rgba(0, 0, 0, .6);
  color: #eef4f2;
}
.fly-intro-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: -.4px;
  color: #ffdc9a;
}
.fly-intro-card p { margin: 0 0 14px; font-size: 13.5px; line-height: 1.6; opacity: .88; }

.fly-keys { margin: 0 0 14px; padding: 0; list-style: none; display: grid; gap: 7px; }
.fly-keys li { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.fly-keys span { margin-inline-start: 6px; opacity: .78; }

.fly-keys kbd {
  min-width: 26px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  direction: ltr;
}
.fly-keys kbd.wide { direction: rtl; min-width: 58px; }
.fly-keys li:first-child span { line-height: 1.35; }

.fly-intro-foot { margin: 0 !important; font-size: 11.5px !important; opacity: .55 !important; }

/* A phone has no keys to list and no cursor to rest; it gets one paragraph
 * instead of the table. */
.fly-intro-touch { display: none; }
@media (pointer: coarse) {
  .fly-keys, .fly-intro-foot { display: none; }
  .fly-intro-touch { display: block; margin: 0 !important; font-size: 13px !important; }
}

/* ---------- one photo, full size ---------- */

body.fly-paused .fly-hud,
body.fly-paused .fly-burner,
body.fly-paused .fly-rush { opacity: 0 !important; pointer-events: none; }
body.fly-paused .fly-hud { transition: opacity .2s linear; }

.fly-view {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 20px 26px;
  background: rgba(3, 6, 8, .92);
}
.fly-view[hidden] { display: none; }

/* The stage holds either the picture or the player; the one that is not in
 * use is hidden, and the frame keeps the same footprint either way so the
 * caption does not jump when a gallery steps from a photo to a video. */
.fly-view-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: min(94vw, 1100px);
  max-height: 74vh;
}

.fly-view-img {
  max-width: min(94vw, 1100px);
  max-height: 74vh;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .7);
  object-fit: contain;
}
.fly-view-img[hidden] { display: none; }

.fly-view-video {
  width: min(94vw, 1100px);
  aspect-ratio: 16 / 9;
  max-height: 74vh;
  border: 0;
  border-radius: 10px;
  background: #000;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .7);
}
.fly-view-video[hidden] { display: none; }

.fly-view-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  color: #eef4f2;
}
.fly-view-name { font-size: 17px; font-weight: 800; }
.fly-view-cap { font-size: 12.5px; opacity: .66; max-width: 60ch; }
.fly-view-count { font-size: 12px; opacity: .55; direction: ltr; font-variant-numeric: tabular-nums; }

/* Stepping through the gallery, at the sides where the app's own lightbox
 * puts them, and with its convention: the left one is onward. */
.fly-view-nav {
  position: absolute;
  top: 50%;
  width: 46px;
  height: 46px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 30px;
  line-height: 1;
}
.fly-view-nav:hover { background: rgba(255, 255, 255, .22); }
.fly-view-nav[hidden] { display: none; }
.fly-view-prev { right: 14px; }
.fly-view-next { left: 14px; }

.fly-view-open {
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: #ffd166;
  color: #22301d;
  font-weight: 800;
  font-size: 13px;
}

.fly-view-x {
  position: absolute;
  top: 16px;
  inset-inline-end: 18px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 26px;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  .fly-intro { animation: none; }
  .fly-rush { display: none; }
  body.fly-unarmed .fly-reticle { animation: none; }
}
