/* ---------- context menu ---------- */
#menu {
  position: fixed; left: 0; top: 0; z-index: 30; box-sizing: border-box;
  width: 224px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow-y: auto; overscroll-behavior: contain;
  padding: 5px; border-radius: 8px; outline: none;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--rule), var(--pop);
  user-select: none; -webkit-user-select: none;
}
.mi {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; height: 30px; padding: 0 10px 0 8px; box-sizing: border-box;
  border: 0; border-radius: 5px; background: transparent; color: var(--ink); cursor: default;
  font: 500 13px/1 var(--f-ui); letter-spacing: -.005em; text-align: left; white-space: nowrap;
}
.mi svg { flex: none; width: 16px; height: 16px; color: var(--ink-2); }
.mi:not(:has(> svg)) { padding-left: 34px; }             /* the icon's slot is kept, so every label starts in one column */
.mi .ml { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mi kbd, .mi .mst { flex: none; font: 500 10.5px/1 var(--f-mono); letter-spacing: .06em; color: var(--ink-3); }
.mi[aria-checked="false"] .snd-w { visibility: hidden; }     /* Sound effects off: the speaker without its waves */
.mi svg.mg { width: 20px; height: 14px; margin-right: -3px; color: var(--ink-3); }
.mi svg.mg circle { fill-opacity: 1; }
/* The pointer moves focus to the item under it, which shows as the fill alone; the ring is for keyboard navigation
   (data-kbd is set by the arrow keys and by opening the menu from the keyboard, and cleared when the pointer moves).
   A press on Upload files… or Open file… may focus its file input (section 14): the item stays filled. */
.mi:focus-within { outline: none; background: color-mix(in srgb, var(--ink) 7%, transparent); }
#menu[data-kbd] .mi:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.mi:focus-within svg { color: var(--ink); }
.mi:focus-within svg.mg { color: var(--ink-2); }
.mi[aria-disabled="true"] { color: var(--ink-3); }
.mi[aria-disabled="true"] svg, .mi[aria-disabled="true"] kbd { color: color-mix(in srgb, var(--ink-3) 70%, transparent); }
.msep { height: 1px; margin: 4px 8px; background: var(--rule); }
/* The menu's head: what it acts on, and where the click was (X, Y in board widths, Z the depth), like a rail card's head. */
.mhead {
  display: flex; align-items: center; gap: 10px; height: 26px; padding: 1px 10px 0; box-sizing: border-box; cursor: default;
  font: 500 9.5px/1 var(--f-mono); white-space: pre; font-variant-numeric: tabular-nums;
}
.mh-w { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.mh-at { flex: none; letter-spacing: .02em; color: var(--ink-q); }
.mh-at .z { color: var(--z); }
@media (pointer: coarse) { .mi { height: 40px; } .mi kbd, .mi svg.mg { display: none; } }

/* landing: the type colour lingers on the border for ~0.4s as confirmation */
.obj.landing, .obj.landing:focus-within {
  border-color: var(--tc); background-color: color-mix(in srgb, var(--tc) 8%, var(--surface));
  box-shadow: none; transition: none;
}
.obj.landing > * { opacity: .35; transition: none; }
.obj.header.landing, .obj.header.landing:focus-within { border-color: transparent; background-color: transparent; }
.obj.header.landing::after { height: 2px; background: var(--tc); transition: none; }
.obj.header.settle::after { transition: background-color 360ms ease-out 60ms, height 200ms ease-out 60ms; }
.obj.timer.landing, .obj.timer.landing:focus-within { border-color: transparent; background-color: transparent; }   /* no card: its rings take the colour */
.obj.timer.landing .tm-ring { stroke: var(--tc); transition: none; }
.obj.timer.settle .tm-ring { transition: stroke 360ms ease-out 60ms; }


/* The Export button's menu (app/js/export.js): the context menu's look, hung under the button at the top right */
#xpMenu {
  position: fixed; left: 0; top: 0; z-index: 30; box-sizing: border-box;
  width: 236px; max-width: calc(100vw - 16px);
  padding: 5px; border-radius: 8px; outline: none;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--rule), var(--pop);
  user-select: none; -webkit-user-select: none;
  transform-origin: 100% 0; animation: xp-in 140ms cubic-bezier(.2, .8, .2, 1);
}
#xpMenu .mi { cursor: pointer; }
#xpMenu .mi:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
#xpMenu .xp-z { stroke: var(--z); }                      /* the board file's: the mark's Z, in XYZ purple */
@keyframes xp-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { #xpMenu { animation: none; } }
