/*
 * One bar that reflows: a row when the panel is wider than tall (docked above the timeline),
 * a strip when it's taller than wide (docked beside it). No setting.
 */
body { overflow: hidden; }

.bar {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  overflow: hidden;
}

.t {
  position: relative;
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--icon);
  cursor: pointer;
  transition: background 130ms var(--ease-out), color 130ms var(--ease-out), transform 130ms var(--ease-out);
}
.t:hover { background: var(--hover); color: var(--text); }
.t:active { transform: scale(0.92); }
.bar.busy .t[data-trigger]:not(.running) { opacity: 0.45; }

/* Click feedback: the icon takes the gradient for a moment. */
.t.pop { color: var(--text); background: rgba(var(--accent-rgb), 0.22); }
.t.pop svg { stroke: url(#nfGrad); }

/* Running: a thin circle spins around the icon while AE works. A circle, not the button's
   rounded square: a square visibly wobbles as it rotates. */
.t.running::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sep { width: 1px; height: 20px; flex: none; margin: 0 4px; background: var(--line); }

.scope button { width: 24px; height: 22px; display: grid; place-items: center; padding: 0; }
.scope svg.i { width: 16px; height: 16px; }

/* Mode: a custom face over a real <select>. The option list is AE's native menu, so it can
   open outside this small panel. */
.mode {
  position: relative;
  flex: none;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px 0 9px;
  background: var(--well);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--text);
  transition: border-color 150ms var(--ease-out);
}
.mode:hover { border-color: var(--line); }
.mode:focus-within { border-color: rgba(var(--accent-rgb), 0.7); }
.mode .short { display: none; font-weight: 600; }
.mode svg { width: 10px; height: 10px; fill: none; stroke: var(--dim); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mode select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; font-size: 12px; }

.grow { flex: 1; min-width: 0; }

.sig { flex: none; font-size: 9px; padding: 0 2px 0 4px; opacity: 0.8; }

/* Result pill. */
.toast {
  position: fixed;
  right: 34px;
  top: 50%;
  max-width: calc(100% - 44px);
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--raised);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) scale(0.96);
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translateY(-50%); }
.toast .ok { font-weight: 600; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* Tracks --error by hand: rgba() cannot take a hex var, and this needs the alpha. Update both
   together, or the border keeps the old colour while the text changes. */
.toast.error { border-color: rgba(229, 72, 77, 0.5); color: var(--error); }
.toast .short { display: none; }

@media (max-aspect-ratio: 1/1) {
  .bar { flex-direction: column; padding: 8px 6px; }
  .sep { width: 22px; height: 1px; margin: 4px 0; }
  .grow { flex: 1; }
  .scope { flex-direction: column; }
  .mode { width: 30px; height: 30px; padding: 0; flex-direction: column; justify-content: center; gap: 0; }
  .mode .full { display: none; }
  .mode .short { display: block; line-height: 1; }
  .sig { padding: 4px 0 0; }
  /* Docked tall there's no room for a sentence: a round badge with the count, ✓ or !. */
  .toast {
    right: auto;
    left: 50%;
    top: auto;
    bottom: 34px;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    display: grid;
    place-items: center;
    font-weight: 600;
    transform: translateX(-50%) scale(0.96);
  }
  .toast .long { display: none; }
  .toast .short { display: inline; }
  .toast:not(.error) .short { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .toast.show { transform: translateX(-50%); }
}

/* Docked tall in a SHORT slot. At full size the column needs about 310px of height; below that
   `overflow: hidden` used to silently eat the bottom controls -- the Preferences button first,
   which made settings unreachable with no hint that anything was missing. So: shrink everything
   first, then let the strip scroll as a last resort, so nothing is ever unreachable.
   The maker's mark is deliberately never hidden here: hiding its slot is exactly what its
   enforcer watches for, and it would just fight the CSS. */
@media (max-aspect-ratio: 1/1) and (max-height: 330px) {
  .bar { gap: 2px; padding: 4px 3px; overflow-y: auto; }
  .t { width: 26px; height: 26px; border-radius: 7px; }
  .t svg.i { width: 17px; height: 17px; }
  .scope button { width: 22px; height: 18px; }
  .scope svg.i { width: 14px; height: 14px; }
  .mode { width: 26px; height: 26px; }
  .sep { margin: 1px 0; }
  /* No point reserving stretch space when there isn't any to give. */
  .grow { flex: 0 0 1px; }
  .sig { padding: 2px 0 0; }
  /* A scrollbar inside a 46px strip would look broken; wheel/trackpad still scrolls. */
  .bar::-webkit-scrollbar { width: 0; height: 0; }
}

/* Docked tall but WIDER than a strip needs. AE will happily give a side dock 130px+, and the
   column was centring inside it: a 26px ribbon of icons floating with ~55px of dead space each
   side, which reads as an empty panel. A true strip (<=64px) still centres, because there
   centring is what looks deliberate. */
@media (max-aspect-ratio: 1/1) and (min-width: 65px) {
  .bar { align-items: flex-start; padding-left: 8px; }
  .toast { left: 8px; transform: translateX(0) scale(0.96); }
  .toast.show { transform: translateX(0); }
}
