/* The tray (panel-tray.js): a second prompt box pulled out from under the first.

   Two boxes, one in front and one behind. The front one is .composer; this is
   the one behind, slid up a little so its top edge and the head of whatever it
   holds show above the bar. It is IN FLOW in .foot, so the conversation above
   gives it room instead of being covered, and it tucks UNDER the bar by
   --tray-tuck: a negative bottom margin (the .foot's 10px gap plus the tuck)
   pulls the bar up over the tray's last strip, which is padding and holds
   nothing. The bar is the one in front (.foot-row, z-index 1). Same ground, same
   radius and same rim light as the bar, a little narrower each side, so it
   reads as the same object — higher, and behind. Theme tokens only. */
.foot { --tray-tuck: 14px; }
.foot-row { z-index: 1; }

/* As small as a question asked in a terminal: one line of words and its answers
   beside it. The same width as the bar, so the two read as one stack. */
.px-tray {
  position: relative; z-index: 0;
  container: pxtray / inline-size;
  margin: 0 0 calc(-10px - var(--tray-tuck));
  padding: 7px 14px calc(var(--tray-tuck) + 5px);
  border-radius: var(--r-card) var(--r-card) 0 0;
  /* The flat ground is the fallback; glass-surface.js upgrades it in place to
     the bar's own liquid glass. */
  background: var(--s-card); box-shadow: var(--lit-card);
  max-height: 140px;
  overflow-y: auto; overscroll-behavior: contain;
  animation: pxTrayOut var(--dur-4) var(--ease-out) both;
}
.px-tray[hidden] { display: none; }
@keyframes pxTrayOut {
  from { transform: translateY(calc(var(--tray-tuck) + 10px)); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .px-tray { animation: none; } }

.px-tray-items { display: flex; flex-direction: column; }
/* [hidden] is only display:none in the UA sheet, so any display set below would
   outrank it (the trap .usage-note documents). */
.px-tray-item[hidden] { display: none; }
.px-tray-items > :not([hidden]) + :not([hidden]) {
  margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--hair);
}

/* The two standing bands, set in the tray rather than on their own grounds. */
.px-tray .usage-note, .px-tray .memory-note {
  padding: 0; border-radius: 0; background: none; border-left: 0;
  box-shadow: none; animation: none; gap: 6px;
  font-size: var(--fs-md);
}
.px-tray .usage-note.spent { background: none; }
.px-tray .un-text, .px-tray .mn-text { font-size: var(--fs-md); line-height: 1.4; }

/* ---- a mirrored approval: the question, then its answers, on one line ---- */
.px-tray-mirror { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.px-tray-head { display: contents; }
.px-tray-label { display: none; }          /* said to a screen reader by the group's aria-label */
.px-tray-text {
  flex: 1 1 150px; min-width: 0;
  font: 400 var(--fs-md)/1.4 var(--sans); color: var(--t-primary); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.px-tray-sub { display: none; }
.px-tray-error { flex-basis: 100%; font-size: var(--fs-sm); color: rgb(var(--danger-rgb)); }
.px-tray-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; }
.px-tray-actions > .px-btn { max-width: 100%; }
/* A card whose action row is in the tray does not offer the same decision twice. */
[data-tray] { display: none !important; }

/* ---- the usage wall: one sentence and its answers ---------------------
   Its parts keep their .lim-* classes; the squares are folded down to their
   buttons, because a person who has just been stopped wants to know what
   happened and what to press, not to read a price list. */
.px-tray-limit { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.px-tray-limit .lim-head { flex: 1 1 200px; min-width: 0; font: 400 var(--fs-md)/1.4 var(--sans); }
.px-tray-limit .lim-title { display: inline; font: inherit; letter-spacing: 0; color: var(--t-primary); }
.px-tray-limit .lim-detail { display: none; }
.px-tray-limit .lim-resets { display: inline; margin: 0; font: inherit; letter-spacing: 0; text-transform: none; color: var(--t-meta); }
.px-tray-limit .lim-grid, .px-tray-limit .lim-foot { display: contents; }
.px-tray-limit .lim-card { display: contents; }
.px-tray-limit :is(.lim-card-title, .lim-price, .lim-card-sub, .lim-unlocks, .lim-alt, .lim-wait) { display: none; }
.px-tray-limit .lim-card-foot { display: contents; }

/* ---- text buttons ------------------------------------------------------
   Nothing in the tray is a plate: an answer is a word you can press. The
   primary one is the brighter word. (The tray opts out of glass with
   data-no-glass, so none of these is upgraded to a pill.) */
.px-tray :is(.px-btn, .lim-go, .lim-off, .un-upgrade, .mn-open, .px-tray-btn) {
  height: auto; min-height: 0; width: auto; padding: 2px 0; margin: 0;
  border: 0; border-radius: 0; background: none; box-shadow: none; filter: none;
  font: 500 var(--fs-md)/1.4 var(--sans); letter-spacing: 0; text-transform: none;
  color: var(--t-secondary); cursor: pointer; white-space: nowrap;
}
.px-tray :is(.px-btn, .lim-go, .lim-off, .un-upgrade, .mn-open, .px-tray-btn):hover:not(:disabled) {
  background: none; color: var(--t-primary); text-decoration: underline; text-underline-offset: 3px;
}
.px-tray :is(.px-btn--primary, .lim-go, .un-upgrade, [data-tray-primary]) { color: var(--t-primary); }
.px-tray :is(.px-btn, .lim-go, .lim-off, .un-upgrade, .mn-open):disabled { color: var(--t-faint); cursor: default; }
.px-tray :is(.px-btn, .lim-go, .lim-off, .un-upgrade, .mn-open):focus-visible {
  outline: 1px solid rgba(var(--rim-rgb), .7); outline-offset: 2px; border-radius: var(--r-ctl);
}
.px-tray .un-close { padding: 0 2px; background: none; border: 0; }

/* ---- a question: full size, one at a time ------------------------------
   The tray grows for it (the one place it is not a single line). The fields are
   panel-ask.css's own (.px-ask-opt, .px-ask-text ...), unscoped. */
.px-tray:has(.px-tray-askform:not([hidden])) { max-height: min(62vh, 460px); }
.px-tray-askform { display: flex; flex-direction: column; gap: 8px; }
.px-tray-count {
  font: 400 var(--fs-xs)/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--t-meta);
}
.px-tray-askform .px-ask-q { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.px-tray-askform .px-ask-q[hidden] { display: none; }
.px-tray-askform .px-ask-q legend { padding: 0; margin-bottom: 6px; color: var(--t-primary); font-size: var(--fs-base); }
.px-tray-askform .px-tray-actions { justify-content: flex-end; margin-top: 2px; }
.px-tray-askform [hidden] { display: none; }
